pthread_cond_timedwait() broken in 9-stable? (from JAN 10)

Julian Elischer julian at
Wed Feb 15 21:39:42 UTC 2012

The program fio (an IO test in ports) uses pthreads

the following code (from fio-2.0.3, but its in earlier code too)
has suddenly started misbehaving.

         clock_gettime(CLOCK_REALTIME, &t);
         t.tv_sec += seconds + 10;


         while (!mutex->value && !ret) {
                 ret = pthread_cond_timedwait(&mutex->cond, 
&mutex->lock, &t);

         if (!ret) {

It turns out that 'ret' sometimes comes back instantly (on my machine) 
with a value of 60 (ETIMEDOUT)
despite the fact that we set the timeout 10 seconds into the future.

Has anyone else seen anything like this?
(and yes the condition variable attribute have been set to use the 
REALTIME clock).

More information about the freebsd-stable mailing list