From 58a157d466c8e366234b4ee694f28be73e6e7702 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 15 Feb 2012 22:20:26 +0100 Subject: [PATCH] Mutex fixes Signed-off-by: Jens Axboe --- mutex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mutex.c b/mutex.c index 6b4c9fe1..24defcf5 100644 --- a/mutex.c +++ b/mutex.c @@ -15,6 +15,7 @@ void fio_mutex_remove(struct fio_mutex *mutex) { + pthread_cond_destroy(&mutex->cond); munmap((void *) mutex, sizeof(*mutex)); } @@ -57,12 +58,12 @@ struct fio_mutex *fio_mutex_init(int value) #ifdef FIO_HAVE_PSHARED_MUTEX pthread_condattr_setpshared(&cond, PTHREAD_PROCESS_SHARED); #endif - pthread_cond_init(&mutex->cond, &cond); #ifdef FIO_HAVE_CLOCK_MONOTONIC pthread_condattr_setclock(&cond, CLOCK_MONOTONIC); #else pthread_condattr_setclock(&cond, CLOCK_REALTIME); #endif + pthread_cond_init(&mutex->cond, &cond); ret = pthread_mutex_init(&mutex->lock, &attr); if (ret) { -- 2.25.1