From: Yedidya Feldblum Date: Tue, 4 Aug 2015 16:54:07 +0000 (-0700) Subject: Refactor extract FOLLY_SYNCHRONIZED_HAVE_TIMED_MUTEX. X-Git-Tag: v0.53.0~10 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=77f6a91425d0f3316144b86e1ef5118da5978402;hp=0347a79f57ee6e1179c0482adacf3a7e6ff890ff Refactor extract FOLLY_SYNCHRONIZED_HAVE_TIMED_MUTEX. 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 --- 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