Some implementations mandate that you hold the lock while
issuing the wakeup, as not to lose a wakeup. This seems to
be the case for Windows. See the lengthy thread on the topic
here:
https://www.spinics.net/lists/fio/msg06772.html
Thanks to Sitsofe Wheeler for heroic debugging.
Reported-by: Rebecca Cran <rebecca@bluestop.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
if (!mutex->value && mutex->waiters)
do_wake = 1;
mutex->value++;
- pthread_mutex_unlock(&mutex->lock);
if (do_wake)
pthread_cond_signal(&mutex->cond);
+
+ pthread_mutex_unlock(&mutex->lock);
}
void fio_rwlock_write(struct fio_rwlock *lock)