aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-09-02 06:54:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-09-02 06:54:24 +0200
commitf57c490ef7d9b205a4b8dff9d6ff18d5476c23dc (patch)
treea09dd5240d1f343c8b18d58ff361953c273f0bdd
parent5f3c97306cda519e7edf41142ee903d22320c84a (diff)
Work around Apple Clang's lack of C++11 thread_local support
-rw-r--r--odb/details/tls.hxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/odb/details/tls.hxx b/odb/details/tls.hxx
index aae148e..6ea0dec 100644
--- a/odb/details/tls.hxx
+++ b/odb/details/tls.hxx
@@ -52,8 +52,17 @@ namespace odb
#elif defined(ODB_THREADS_CXX11)
-# define ODB_TLS_POINTER(type) thread_local type*
-# define ODB_TLS_OBJECT(type) thread_local type
+// Apparently Apple's Clang "temporarily disabled" C++11 thread_local until
+// they can implement a "fast" version, which reportedly happened in XCode 8.
+// So for now we will continue using __thread for this target.
+//
+# if defined(__apple_build_version__) && __apple_build_version__ < 8000000
+# define ODB_TLS_POINTER(type) __thread type*
+# define ODB_TLS_OBJECT(type) thread_local type
+# else
+# define ODB_TLS_POINTER(type) thread_local type*
+# define ODB_TLS_OBJECT(type) thread_local type
+# endif
namespace odb
{