summaryrefslogtreecommitdiff
path: root/mutex.c
diff options
context:
space:
mode:
authorBruce Cran <bruce@cran.org.uk>2013-03-29 16:17:25 +0000
committerJens Axboe <axboe@kernel.dk>2013-03-29 10:38:08 -0600
commit09f17d62b3bcade70bca6c8660a6a2cb75ab0ca2 (patch)
tree11bd889b2f08b42ce1a8c06a3207d780adbd9bf3 /mutex.c
parentcdb57fe2e6ab3418e0e137282be46201b1f5acc0 (diff)
downloadfio-09f17d62b3bcade70bca6c8660a6a2cb75ab0ca2.tar.gz
Workaround pthreads-win32 pthread_rwlock_init limitation.
On Windows, pthreads-win32 returns EINVAL if you specify an attribute when calling pthread_rwlock_init. Work around this by only specifying the attribute when FIO_HAVE_PSHARED_MUTEX is defined. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'mutex.c')
-rw-r--r--mutex.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mutex.c b/mutex.c
index d1e3ceae..e1fbb607 100644
--- a/mutex.c
+++ b/mutex.c
@@ -205,9 +205,12 @@ struct fio_rwlock *fio_rwlock_init(void)
log_err("pthread_rwlockattr_setpshared: %s\n", strerror(ret));
goto destroy_attr;
}
-#endif
ret = pthread_rwlock_init(&lock->lock, &attr);
+#else
+ ret = pthread_rwlock_init(&lock->lock, NULL);
+#endif
+
if (ret) {
log_err("pthread_rwlock_init: %s\n", strerror(ret));
goto destroy_attr;