timeBeginPeriod considered harmful

Christopher Faylor me@cgf.cx
Sat Nov 12 23:16:00 GMT 2005


On Fri, Nov 11, 2005 at 05:47:17PM -0500, Pierre A. Humblet wrote:
>I worked on the resolution issue a while back, to insure the following
>Posix behavior (exim relies on it):
>If you 1) call time() or equivalent, 2) sleep() or alarm() for some
>interval, 3) call time() again, then the difference between the times in
>3) and 1) cannot be smaller than the interval in 2).  Insuring that is
>easier if the resolution is known.
>I am not sure if Cygwin still behaves that way, insuring it requiring
>rounding up at various places.

I was thinking about the above in the thinking room today and it
occurred to me that the right way (tm) to fix this problem would be to
modify sleep/alarm so that the above is true.  alarm might be slightly
trickier than sleep but I don't think it would be unbelievably hard.  It
seems like adding a low_priority_sleep loop to nanosleep and alarm which
waits until the time delta was >= what was expected would be preferable
to forcing the resolution to 1ms for the whole program forever.

cgf



More information about the Cygwin-developers mailing list