t/dedupe: use generic blockdev_size() to get size
[fio.git] / mutex.c
diff --git a/mutex.c b/mutex.c
index 466e20ed1111ea0cad675165b8eea9ab298a7ef2..9ee3bd838cb1ae801b71f2604f94441264130343 100644 (file)
--- a/mutex.c
+++ b/mutex.c
@@ -15,7 +15,7 @@
 #include "arch/arch.h"
 #include "os/os.h"
 #include "helpers.h"
-#include "time.h"
+#include "fio_time.h"
 #include "gettime.h"
 
 void fio_mutex_remove(struct fio_mutex *mutex)
@@ -162,14 +162,19 @@ void fio_mutex_down(struct fio_mutex *mutex)
 
 void fio_mutex_up(struct fio_mutex *mutex)
 {
+       int do_wake = 0;
+
        assert(mutex->magic == FIO_MUTEX_MAGIC);
 
        pthread_mutex_lock(&mutex->lock);
        read_barrier();
        if (!mutex->value && mutex->waiters)
-               pthread_cond_signal(&mutex->cond);
+               do_wake = 1;
        mutex->value++;
        pthread_mutex_unlock(&mutex->lock);
+
+       if (do_wake)
+               pthread_cond_signal(&mutex->cond);
 }
 
 void fio_rwlock_write(struct fio_rwlock *lock)