Fix problem with mutexes and MONOTONIC clock
authorRoland Dreier <rdreier@cisco.com>
Wed, 7 Oct 2009 20:01:42 +0000 (22:01 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 7 Oct 2009 20:01:42 +0000 (22:01 +0200)
commit666bf1234912c3790ff1e6204596891c6ef7180c
tree891fa73c764f845dfb18ab89bcca8e6b4b6ebdbc
parentb767c7f8e3fd8efff51debe39149c65028cf963d
Fix problem with mutexes and MONOTONIC clock

With the latest fio git tree, I get:

    fio: job startup hung? exiting.

on startup, and it looks like the latest commit, 69a852f5 ("Fix wrong
clock source in mutex") breaks things for me (Ubuntu 9.10 beta).  My
system seems to use CLOCK_REALTIME for pthread_cond_timedwait() by
default.

The cleanest solution seems to be to explicitly set which clock to use
in pthread_cond_timedwait() via pthread_condattr_setclock() when
initializing the condition variable, although I'm not sure how portable
this is away from modern Linux (ie do all platforms that fio cares about
have pthread_condattr_setclock()?).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
mutex.c