[PATCH] clock_nanosleep(2), pthread_condattr_[gs]etclock(3)

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Jul 21 19:09:00 GMT 2011

On Jul 21 13:59, Yaakov (Cygwin/X) wrote:
> On Thu, 2011-07-21 at 11:35 +0200, Corinna Vinschen wrote:
> > On Jul 21 11:21, Corinna Vinschen wrote:
> > > No, you're not at all off-base.  Personally I'd prefer to use the native
> > > NT timer functions, but that's not important.
> No problem, that's something I keep forgetting about.
> > > What I'm missing is a way to specify relative vs. absolute timeouts in
> > > your above sketch.  I guess we need a flag argument as well.
> Working on this last night, I decided to make the timeout a LONGLONG of
> 100ns units instead, positive for absolute and negative for relative.

Good idea.  The value can be immediately used in NtSetTimer and it
can be used for testing.

> > Btw., if you call NtQueryTimer right before NtCancelTimer, then you get
> > the remaining time for free to return to clock_nanosleep.  It would
> > be nice if NtQueryTimer would return the remaining time after calling
> > NtCancelTimer, but my experiments show that some weird value gets
> > returned.  See my attached testcase.  Build with -lntdll.
> Thanks, that was the piece I was missing last night.

Just ignore the bug in the while expression, please...


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list