473,395 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Sleep exactly xpto miliseconds in a method/function!!

3
Hi everyone!!

I am doing a school project, actually is "the pacmen"! It's a multiplayer game and we are using a parallel laplink cable for the comunications.

The problem is that I need to sleep in a method that receive a nibble from the parallel port! But I need precision , if I sleep 3ms I want 3ms not 4ms or 8ms... I am using a multimedia timer do syncronize everything, but in this particular case I really need to sleep that function!

Anyone nows a sleep replacement that is accurate ?


Thanks :)
Dec 1 '06 #1
2 1687
Banfa
9,065 Expert Mod 8TB
It would be hard to sleep a thread for that amount of time exactly.

You could possibly hold it up for that amount of time using a for loop and some timer functions. However if this is running on Windows you some other high level OS then you have no guarantee that the OS will not de-schedule your entire program for that amount of time in order to let something else run.
Dec 1 '06 #2
vador
3
It would be hard to sleep a thread for that amount of time exactly.

You could possibly hold it up for that amount of time using a for loop and some timer functions. However if this is running on Windows you some other high level OS then you have no guarantee that the OS will not de-schedule your entire program for that amount of time in order to let something else run.

Yep that's true.. but I think i can resolve that with something more accurate then the sleep! Not a multimedia timer because i need to reference a pointer to function .. I just want something like Sleep() but much more accurate! Is possible?


thanks
Dec 1 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: OKB (not okblacke) | last post by:
I've noticed some peculiar behavior from copy.deepcopy: if you pass it a method or function object, it raises a TypeError somewhere in copy_reg saying "function() takes at least 2 arguments (0...
0
by: Gautham Jayaraman | last post by:
Hi All, Please let me know, If anybody in the group knows how to create a new Custom Method Wizard for your class. In the Class View, for my class, I want to right click and add a my method...
2
by: The Mess | last post by:
I am using VB5. I wish I had a function to draw a line, giving the angle and length but I do not have the math skills involved to do this. Does anyone have a function that they care to share that...
4
by: Sullivan WxPyQtKinter | last post by:
In python, these expression seems yields the same result: inputstring='ABC' print inputstring.lower() print lower(inputstring) print string.lower(inputstring) result: abc
1
by: Pankaj | last post by:
Hello friends, I am implementing something like PM |------------------------------------------------------ | | | | | ------- -|...
4
by: seaside | last post by:
Currently, I use this call traceVariable( $_SERVER, '$_SERVER' ); to pass a variable by reference to 'traceVariable' and by value a description string. Since the description string is very...
12
by: trullock | last post by:
Hi, Is there a way to call a codebehind method/function from an attribute of a runat=server tag, kinda like this: <asp:Literal runat="server" ID="litTest" Text='<%# MyMethod("testargs") %>'...
10
by: Matthew | last post by:
Am I correct in thinking there is no method/function overloading of any kind in any version of PHP? Thanks, Matthew
6
guillermobytes
by: guillermobytes | last post by:
Hi, I was wondering if there is a way (from an interface or abstract class) to force all classes implementing some method to return a specific type, like in Java. example : //method can only...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.