No std::recursive_timed_mutex and std::timed_mutex.
authorMichael Lee <mzlee@fb.com>
Fri, 31 Jul 2015 21:06:17 +0000 (14:06 -0700)
committerfacebook-github-bot-4 <folly-bot@fb.com>
Fri, 31 Jul 2015 21:22:15 +0000 (14:22 -0700)
Summary: Do not use these if __ANDROID__ is defined as well.

Reviewed By: @​yangchi

Differential Revision: D2301782

folly/Synchronized.h

index 0bbe788f0acbecac52c10a263f5ebd97c419ac96..55fd73c1b50c89b9b97bc677c74f13e0c73409fc 100644 (file)
@@ -49,8 +49,9 @@ struct HasLockUnlock {
   enum { value = IsOneOf<T,
          std::mutex, std::recursive_mutex,
          boost::mutex, boost::recursive_mutex, boost::shared_mutex
-// OSX and Cygwin don't have timed mutexes
-#if !defined(__APPLE__) && !defined(__CYGWIN__)
+// Android, OSX, and Cygwin don't have timed mutexes
+#if !defined(ANDROID) && !defined(__ANDROID__) && \
+  !defined(__APPLE__) && !defined(__CYGWIN__)
         ,std::timed_mutex, std::recursive_timed_mutex,
          boost::timed_mutex, boost::recursive_timed_mutex
 #endif
@@ -98,8 +99,9 @@ acquireReadWrite(T& mutex) {
   mutex.lock();
 }
 
-// OSX and Cygwin don't have timed mutexes
-#if !defined(__APPLE__) && !defined(__CYGWIN__)
+// Android, OSX, and Cygwin don't have timed mutexes
+#if !defined(ANDROID) && !defined(__ANDROID__) && \
+  !defined(__APPLE__) && !defined(__CYGWIN__)
 /**
  * Acquires a mutex for reading and writing with timeout by calling
  * .try_lock_for(). This applies to two of the std mutex classes as
@@ -131,7 +133,7 @@ acquireReadWrite(T& mutex,
                  unsigned int milliseconds) {
   return mutex.timed_lock(boost::posix_time::milliseconds(milliseconds));
 }
-#endif // __APPLE__
+#endif // !__ANDROID__ && !__APPLE__ && !__CYGWIN__
 
 /**
  * Releases a mutex previously acquired for reading by calling