Commit bfe9e3dd authored by Michael Lee's avatar Michael Lee Committed by facebook-github-bot-4

No std::recursive_timed_mutex and std::timed_mutex.

Summary: Do not use these if __ANDROID__ is defined as well.

Reviewed By: @​yangchi

Differential Revision: D2301782
parent 0aac0635
...@@ -49,8 +49,9 @@ struct HasLockUnlock { ...@@ -49,8 +49,9 @@ struct HasLockUnlock {
enum { value = IsOneOf<T, enum { value = IsOneOf<T,
std::mutex, std::recursive_mutex, std::mutex, std::recursive_mutex,
boost::mutex, boost::recursive_mutex, boost::shared_mutex boost::mutex, boost::recursive_mutex, boost::shared_mutex
// OSX and Cygwin don't have timed mutexes // Android, OSX, and Cygwin don't have timed mutexes
#if !defined(__APPLE__) && !defined(__CYGWIN__) #if !defined(ANDROID) && !defined(__ANDROID__) && \
!defined(__APPLE__) && !defined(__CYGWIN__)
,std::timed_mutex, std::recursive_timed_mutex, ,std::timed_mutex, std::recursive_timed_mutex,
boost::timed_mutex, boost::recursive_timed_mutex boost::timed_mutex, boost::recursive_timed_mutex
#endif #endif
...@@ -98,8 +99,9 @@ acquireReadWrite(T& mutex) { ...@@ -98,8 +99,9 @@ acquireReadWrite(T& mutex) {
mutex.lock(); mutex.lock();
} }
// OSX and Cygwin don't have timed mutexes // Android, OSX, and Cygwin don't have timed mutexes
#if !defined(__APPLE__) && !defined(__CYGWIN__) #if !defined(ANDROID) && !defined(__ANDROID__) && \
!defined(__APPLE__) && !defined(__CYGWIN__)
/** /**
* Acquires a mutex for reading and writing with timeout by calling * Acquires a mutex for reading and writing with timeout by calling
* .try_lock_for(). This applies to two of the std mutex classes as * .try_lock_for(). This applies to two of the std mutex classes as
...@@ -131,7 +133,7 @@ acquireReadWrite(T& mutex, ...@@ -131,7 +133,7 @@ acquireReadWrite(T& mutex,
unsigned int milliseconds) { unsigned int milliseconds) {
return mutex.timed_lock(boost::posix_time::milliseconds(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 * Releases a mutex previously acquired for reading by calling
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment