From f57c490ef7d9b205a4b8dff9d6ff18d5476c23dc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 2 Sep 2016 06:54:24 +0200 Subject: Work around Apple Clang's lack of C++11 thread_local support --- odb/details/tls.hxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'odb') 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 { -- cgit v1.1