Implementation of pthread_cond_wait() with CLOCK_MONOTONIC

Benedikt Spranger b.spranger@linutronix.de
Wed Feb 4 19:51:00 GMT 2009


Hi,

while looking for a strange behavior of an application, I tracked down
the implementation of pthread_cond_wait(). The application sets the
clocksource via pthread_condattr_setclock() to CLOCK_MONOTONIC. The
implementation of pthread_cond_wait() calls the clock_gettime syscall
(with CLOCK_MONOTONIC) and calculates a delta. Everything fine here.
But now lll_futex_timed_wait() is called. As I see, this results in a
futex syscall. Maybe I am wrong, but as I see in the futex kernel
syscall implementation, this syscall relies on CLOCK_REALTIME. Did I
oversee something or is the actual implementation of
pthread_cond_timedwait() broken and a application cannot avoid clock
screws here?

regards
Benedikt Spranger



More information about the Libc-help mailing list