From 77f6a91425d0f3316144b86e1ef5118da5978402 Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Tue, 4 Aug 2015 09:54:07 -0700 Subject: [PATCH] Refactor extract FOLLY_SYNCHRONIZED_HAVE_TIMED_MUTEX. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Summary: [Folly] Refactor extract FOLLY_SYNCHRONIZED_HAVE_TIMED_MUTEX. The same complex check is done in two places. Ick. Extract it to a single place. Reviewed By: @​mzlee Differential Revision: D2302885 --- folly/Synchronized.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/folly/Synchronized.h b/folly/Synchronized.h index 55fd73c1..4fc47afd 100644 --- a/folly/Synchronized.h +++ b/folly/Synchronized.h @@ -39,6 +39,14 @@ enum InternalDoNotUse {}; * Free function adaptors for std:: and boost:: */ +// Android, OSX, and Cygwin don't have timed mutexes +#if defined(ANDROID) || defined(__ANDROID__) || \ + defined(__APPLE__) || defined(__CYGWIN__) +# define FOLLY_SYNCHRONIZED_HAVE_TIMED_MUTEXES 0 +#else +# define FOLLY_SYNCHRONIZED_HAVE_TIMED_MUTEXES 1 +#endif + /** * Yields true iff T has .lock() and .unlock() member functions. This * is done by simply enumerating the mutexes with this interface in @@ -49,9 +57,7 @@ struct HasLockUnlock { enum { value = IsOneOf