aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/stubs/common.h
diff options
context:
space:
mode:
authorGravatar Austin Schuh <austin@peloton-tech.com>2015-06-08 18:49:16 -0700
committerGravatar Austin Schuh <austin@peloton-tech.com>2015-06-08 18:49:16 -0700
commitfd73235f6b2534aa63af41359d9f386ade43a5cc (patch)
tree17eef748320d5e3ac728e12f04e88fa5fa301871 /src/google/protobuf/stubs/common.h
parent9cbdaedb86debc56ffec91935ee9546f3c92eb0a (diff)
Refactored threadlocal logic.
Refactored the threadlocal logic for Android and IOS into logic in platform_macro.h which computes a GOOGLE_PROTOBUF_NO_THREADLOCAL define which is then used elsewhere. This allows new platforms without THREADLOCAL to be easily defined.
Diffstat (limited to 'src/google/protobuf/stubs/common.h')
-rw-r--r--src/google/protobuf/stubs/common.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h
index e4c35a2f..49d16020 100644
--- a/src/google/protobuf/stubs/common.h
+++ b/src/google/protobuf/stubs/common.h
@@ -62,6 +62,8 @@
#include <exception>
#endif
+#include <google/protobuf/stubs/platform_macros.h>
+
#if defined(__APPLE__)
#include <TargetConditionals.h> // for TARGET_OS_IPHONE
#endif
@@ -1174,11 +1176,7 @@ class LIBPROTOBUF_EXPORT MutexLockMaybe {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLockMaybe);
};
-#if defined(__ANDROID__) || defined(GOOGLE_PROTOBUF_OS_ANDROID) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || defined(GOOGLE_PROTOBUF_OS_IPHONE)
-// Android ndk does not support the __thread keyword very well yet. Here
-// we use pthread_key_create()/pthread_getspecific()/... methods for
-// TLS support on android.
-// iOS also does not support the __thread keyword.
+#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
template<typename T>
class ThreadLocalStorage {
public: