gettime: Rework the clock thread starting mechanism
authorBart Van Assche <bart.vanassche@wdc.com>
Tue, 13 Mar 2018 17:43:02 +0000 (10:43 -0700)
committerBart Van Assche <bart.vanassche@wdc.com>
Thu, 15 Mar 2018 16:56:43 +0000 (09:56 -0700)
commit17031c6df30913608de1f66ca952ed75dd1324be
tree19766cd79afabd02d3ec5f517b61fe33f43dd140
parent0ffccc21fcd67d1e1d2a360e90f3fe8efc0d6b52
gettime: Rework the clock thread starting mechanism

Replace two mutexes in struct clock_thread that are intended to make
the clock threads start simultaneously by a fio_mutex.

This patch avoids that drd reports the following:

==23831== Thread 2:
==23831== Mutex not locked by calling thread: mutex 0x6cb7bf8, recursion count 1, owner 1.
==23831==    at 0x4C38EC3: pthread_mutex_unlock_intercept (drd_pthread_intercepts.c:978)
==23831==    by 0x4C38EC3: pthread_mutex_unlock (drd_pthread_intercepts.c:991)
==23831==    by 0x420974: clock_thread_fn (gettime.c:604)
==23831==    by 0x4C34C44: vgDrd_thread_wrapper (drd_pthread_intercepts.c:444)
==23831==    by 0x5E4159A: start_thread (in /lib64/libpthread-2.27.so)
==23831==    by 0x6356A1E: clone (in /lib64/libc-2.27.so)

==23924== Mutex still locked at thread exit: mutex 0x6cb7bd0, recursion count 1, owner 2.
==23924==    at 0x4C35BF2: pthread_join_intercept (drd_pthread_intercepts.c:711)
==23924==    by 0x4C35BF2: pthread_join (drd_pthread_intercepts.c:718)
==23924==    by 0x420D7F: fio_monotonic_clocktest (gettime.c:722)
==23924==    by 0x420441: fio_clock_init (gettime.c:424)
==23924==    by 0x437526: fio_time_init (time.c:141)
==23924==    by 0x49BF41: main (fio.c:56)

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Makefile
gettime.c