I'm not sure if there is one that exists but try to use a sleep call with microsecond precision instead of millisecond. You will be able to have a finer control over the period.
However, there are issues with this. Usually, you are not guaranteed to have an exact sleep time. Often times the microsecond times are estimated or 'binned' and not true measurements. Also, other factors/processes can influence the reliability of your performance on a shared system.
L7Sqr
Practically a Master Poster
657 posts since Feb 2011
Reputation Points: 201
Solved Threads: 124
You can use the Boost.Date-Time library and the Boost.Thread library, they offer timing functions with, in theory, a precision up to nano-seconds and similarly for the thread sleeping functions. Of course, when your system cannot support nanosecond timing then it will be rounded to the smallest possible precision your computer supports (usually some fraction of a micro-second, most recent computers support at least micro-second precision, unless it is really old).
In general, you can't really depend on the thread system to be precise even if your clock is precise enough. The problem is that putting threads to sleep, scheduling them, waking them up and such, are all things that the OS can't guarantee to do with precise timing. But, for fractions of milliseconds, it's not so bad. To get really precise timing on thread executions, you need a Real-Time Operating System (RTOS), which means that it can implement what is called "hard real-time" where you can specify very precise interrupt intervals to restart a thread (it uses low-level interrupts that can provide real guarantees for precise timing, close to the clock-freq. of your processor).
mike_2000_17
Posting Virtuoso
2,139 posts since Jul 2010
Reputation Points: 1,634
Solved Threads: 457
Then you need to use an interrupt based on the real-time clock alarms. This is the only method to precisely wake-up a thread based on hard real-time constraints. I don't know much about windows CE so I can't really help you with the details, you need to browse msdn reference pages for instruction of setting up the RTC timer and handling the interrupt.
mike_2000_17
Posting Virtuoso
2,139 posts since Jul 2010
Reputation Points: 1,634
Solved Threads: 457