[Patch] nanosleep()

Pierre A. Humblet pierre@phumblet.no-ip.org
Thu Sep 4 14:06:00 GMT 2003

Christopher Faylor wrote:
>On Wed, Sep 03, 2003 at 11:26:51PM -0400, Pierre A. Humblet wrote:
>>This patch to nanosleep, sleep and usleep 
>>a) makes them Posix conformant: the system clock (gettimeofday) must 
>>   advance by at least d during Xsleep(d) 
>>  (e.g. exim relies on this to create unique ids).
>And it doesn't, do that now, because...?
  it doesn't round up to the clock resolution (see ChangeLog)

>>b) improves the resolution of the result by using the multimedia 
>>   timer. 
>And it does that how...?
  by calling timeGetTime instead of GetTickCount (see ChangeLog)

>>c) calls timeBeginPeriod in forked processes.
>This one at least doesn't deserve a discussion.  Or does it?  Is
>timeBeginPeriod necessary in a forked process?
 By a strict reading of MS, yes. I have also experimented. On at 
 least one system I have noticed the clock resolution in the child 
 getting worse after the death of its parent. This seems to indicate
 that (at least some) Windows considers all processes when setting
 the resolution, but it wouldn't be safe to assume that there always
 is some other process with the desired resolution.

>Large patches with lots of reorganization and minimal explanation about
>why are quite time consuming to review.  This is why on most patches
>list the usual rule is one patch per concept.  I meant to mention this
>after your massive signal patch.
>For instance, c) above is a concept.  It could probably have been a
>separate patch.
>So, I would appreciate it if you could break this down into separate
>concepts and explain the concepts as you go along.  Call me selfish, but
>it reduces my workload to have you explain what you are doing in bite
>size chunks so that I don't have to spend a lot of time trying to
>separate out your patch into separate issues myself.

OK, that will be for tonight. I will split into two patches: 
1) hires.h and times.cc, basically adding two methods to class hires_ms
   and changing minperiod to static NO_COPY.
2) signals.cc, applying the new methods to nanosleep and making minor
Note that if I had sent only the first one I would have had to justify
why the new methods are useful and you would have had to trust that 
they are. Now you can judge directly.
The complexity of this patch is minimal.


More information about the Cygwin-patches mailing list