To all,
Is there a way to increase the resolution of the sleep function below what seems to be 20 msec limit. Is it possible to get resolution below 1 msec in Visual C++ Or is there a work around Thanks.
Visual C++ General
To all,
Is there a way to increase the resolution of the sleep function below what seems to be 20 msec limit. Is it possible to get resolution below 1 msec in Visual C++ Or is there a work around Thanks.
No, there's latency built in to all the Win32 timer/sleep functions.
You can try using a multimedia timer, but in my experience, and no matter what MS likes to say, Windows is a high-latency OS. I highly doubt you can get < 1 MS resolution reliably without dedicated hardware.
It's the reason why all the best audio/video suites (ProTools, etc) were initially debuted on the Mac. Only as hardware got faster did comparable programs start to appear on Windows.
Please don't be fooled by the hype. Windows is not a real-time OS. And was not intended to be. And can't be backfilled to be made to be.
Hope this helps.
James
rtpninja wrote:
No, there's latency built in to all the Win32 timer/sleep functions.
Well it's not as much a latency issue as an effect of how time slices are divided between threads. When you call a function such as Sleep, the thread will typically yield its execution to the system or other threads. Even though the sleep itself isn't more than one millisecond, the thread will not be given new execution time until the next time the system clock ticks. Depending on the Windows version, the tick frequency can be anything from 7 to 55 milliseconds.
Simple Samples wrote: