Subject: pthread_cond_timedwait() CLOCK_REALTIME, and pthread_condattr_setclock()
To: None <tech-kern@netbsd.org>
From: Tad Hunt <tad@entrisphere.com>
List: tech-kern
Date: 01/30/2004 13:46:47
We have an application where we need a pthread_cond_timedwait()
thad is not affected by changes to the system clock (CLOCK_REALTIME).

It appears as though there is a condition attribute defined which
can be used to change the default clock for a condition variable
from CLOCK_REALTIME to any other supported clock.

http://www.opengroup.org/onlinepubs/007904975/functions/pthread_condattr_setclock.html

It doesn't appear as though this optional attribute is implemented
in NetBSD-current.  Are there any plans to do so?

In the meantime, I've written my own clock_gettime which replaces
the one from libc and overrides the clock id passed in with
CLOCK_MONOTONIC.  This works for this application, but it is nothing
more than a hack!

-Tad