sub msec sleep/timers

Brian Ford
Fri Sep 19 20:07:00 GMT 2003

On Thu, 18 Sep 2003, Pierre A. Humblet wrote:

> At 01:59 PM 9/18/2003 -0500, Brian Ford wrote:
> >Pierre, are you or anyone else planning on enhancing
> >nanosleep/usleep/itimer functions, etc. to sub msec accuracy?
> Brian,
> I have an implementation with 1 ms resolution using the multimedia
> timer (available on all platforms). It works fine on NT but I belatedly
> discovered that the max delay is 64k ms on Win9x, so more work is
> still required there.
> If you go ahead with WaitableTimers I will stop my efforts, so let
> us know.
Well, I may still go ahead with WaitableTimers, but given my schedule,
Windows/Cygwin programming experience, and current lack of assignment form
on file, I certainly wouldn't want to hold up any enhancements/bug fixes
you have in the wings.

> You may want to check the effective resolution of such timers.
> It's not because they measure time in 100ns units that they have
> 100ns resolution.
Yes, I know.

Waitable timers do seem to get tick rate accuracy in my tests so far on
XP/2k/NT.  On 98, I think the same is true, but scheduling accuracy in
general seems to be all over the board.  Have you seen this too?

They might be available on 95 too.  The MS documentation is not
clear to me and I don't have any 95 boxes to test on.

I have no idea yet what the max sleep time is with them.  What do we need?

> For example the current timer measures time in ms > but has 10 ms
> resolution on NT, more on 9X.
Really?  I get much better response than that with nanosleep on NT and 98.

> Pierre
> >It looks like it could be done via [Create|Open|Set|Cancel]WaitableTimer,
> >at least on >= 98.  Would this be an acceptable enhancement for >= 98
> >systems via a wincap test or the like?
> >
> >If so, and no one is working on it, I may take a shot.  We have in-house
> >vis-sim apps that could really benefit from sub msec accuracy/scheduling.
> >
> >If anyone has looked at this before and has tips/pointers/"you can't do
> >that", etc., please let me know.  I am quite new to Windows programming.
> >

Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444

More information about the Cygwin-developers mailing list