Mac build fix. Macs don't support timeouts on locks.
Change-Id: I75665300d9b99420972865109026c8c090748cef
diff --git a/src/mutex.cc b/src/mutex.cc
index dc33fbe..18c9453 100644
--- a/src/mutex.cc
+++ b/src/mutex.cc
@@ -302,10 +302,8 @@
CHECK_MUTEX_CALL(pthread_rwlock_unlock, (&rwlock_));
}
+#if HAVE_TIMED_RWLOCK
bool ReaderWriterMutex::ExclusiveLockWithTimeout(const timespec& abs_timeout) {
- // Check that timeouts are supported. Currently Darwin doesn't support timeouts, if we are
- // running on Darwin the timeout won't be respected.
-#if defined(_POSIX_TIMEOUTS) && (_POSIX_TIMEOUTS - 200112) >= 0L
int result = pthread_rwlock_timedwrlock(&rwlock_, &abs_timeout);
if (result == ETIMEDOUT) {
return false;
@@ -317,12 +315,8 @@
RegisterAsLockedWithCurrentThread();
AssertSharedHeld();
return true;
-#else
- UNUSED(abs_timeout);
- ExclusiveLock();
- return true;
-#endif
}
+#endif
void ReaderWriterMutex::SharedLock() {
CHECK_MUTEX_CALL(pthread_rwlock_rdlock, (&rwlock_));