[PATCH] clock_nanosleep(2)

Yaakov (Cygwin/X) yselkowitz@users.sourceforge.net
Wed Aug 3 09:20:00 GMT 2011


On Wed, 2011-08-03 at 09:45 +0200, Corinna Vinschen wrote:
> On Aug  3 01:20, Yaakov (Cygwin/X) wrote:
> > On Tue, 2011-08-02 at 17:42 +0200, Corinna Vinschen wrote:
> > > Does that mean the return value from NtQueryTimer is unreliable?
> > > In what way is it wrong?  
> > 
> > I'm not sure.  When I run an STC (attached), it works as expected.  In
> > cancelable_wait(), however, it returns the negative system uptime.  Is
> > Cygwin doing something to make this occur?
> 
> That sounds weird.  How should Cygwin influence what an independent OS
> function returns?  And you sure it's the system uptime?  Wow.

Never mind, I figured it out.  The difference is the timeout to
WaitFor*Object*(); my STC doesn't allow the timer to finish, but
cancelable_wait() does with the INFINITE timeout.  If there is time
remaining, as in the STC, then TIMER_BASIC_INFORMATION.TimeRemaining
contains just that (as a positive).  If the timer has signalled, then
instead of zero, it appears to provide when it was signalled (system
uptime, as a negative).

With that figured out, here's a revised patch.  Once this is in, then
adding clock_nanosleep() should be relatively easy.


Yaakov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin-waitable-timer.patch
Type: text/x-patch
Size: 22181 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20110803/cc35d3bf/attachment.bin>


More information about the Cygwin-patches mailing list