rwlock: Don't use buggy pthread_rwlock on OS X
authorMartin Willi <martin@revosec.ch>
Thu, 24 Oct 2013 11:45:31 +0000 (13:45 +0200)
committerMartin Willi <martin@revosec.ch>
Thu, 24 Oct 2013 12:53:47 +0000 (14:53 +0200)
Recursive read locks don't seem to work properly, at least on 10.9.

src/libstrongswan/threading/rwlock.c

index c0f8ec8..770061b 100644 (file)
 #include "mutex.h"
 #include "lock_profiler.h"
 
+#ifdef __APPLE__
+/* while pthread_rwlock_rdlock(3) says that it supports multiple read locks,
+ * this does not seem to be true. After releasing the a recursive rdlock,
+ * a subsequent wrlock fails... */
+# undef HAVE_PTHREAD_RWLOCK_INIT
+#endif
+
 typedef struct private_rwlock_t private_rwlock_t;
 typedef struct private_rwlock_condvar_t private_rwlock_condvar_t;