[PATCH] clock_nanosleep(2)

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

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?

> Does nanosleep wait too long or not long enough?

That doesn't seem to be an issue.

> If NtQueryTimer is unusable, maybe we should just skip the idea to return
> the remaining time from cancelabel_wait and simply use the return
> value from hires_ms::timeGetTime_ns() to return the remaining time
> from {clock_}nanosleep

I'd rather avoid this type of workaround, particularly with
clock_nanosleep having to deal with CLOCK_MONOTONIC as well.

> > and the pthread_spin chunk doesn't look right (previously
> > the timeout would repeat in the while loop, but that won't happen the
> > way the waitable timer is set up).
> It doesn't look wrong to me, but then again, I didn't test it...

You're right, since we pay no attention to the return value of
cancelable_wait() here.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ntquerytimer-test.c
Type: text/x-csrc
Size: 888 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20110803/646e07df/attachment.bin>

More information about the Cygwin-patches mailing list