aboutsummaryrefslogtreecommitdiff
path: root/odb
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-09-14 15:13:43 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-09-14 15:13:43 +0200
commitf7c9c07973ff5a1041036478fcae87f77457d737 (patch)
tree53c048a7b1f9a06af8d3ce029ac77451a5beeb8f /odb
parentf7bf16d50f6f08c66b1bae35e2dab327d560b0f3 (diff)
Use __thread keyword if available
Diffstat (limited to 'odb')
-rw-r--r--odb/Makefile.am4
-rw-r--r--odb/details/config.h.in2
-rw-r--r--odb/details/tls.hxx28
3 files changed, 31 insertions, 3 deletions
diff --git a/odb/Makefile.am b/odb/Makefile.am
index 9922a37..d671b16 100644
--- a/odb/Makefile.am
+++ b/odb/Makefile.am
@@ -22,5 +22,5 @@ libodb_la_SOURCES += __path__(win32_sources) __path__(win32_dll_sources)
nobase_odbinclude_HEADERS += __path__(win32_headers)
endif
-libodb_la_CPPFLAGS= -I'$(top_builddir)' -I'$(top_srcdir)' -DLIBODB_DYNAMIC_LIB
-libodb_la_LDFLAGS = -release __value__(interface_version) -no-undefined
+AM_CPPFLAGS= -I'$(top_builddir)' -I'$(top_srcdir)' -DLIBODB_DYNAMIC_LIB
+AM_LDFLAGS = -release __value__(interface_version) -no-undefined
diff --git a/odb/details/config.h.in b/odb/details/config.h.in
index a55352a..acab724 100644
--- a/odb/details/config.h.in
+++ b/odb/details/config.h.in
@@ -12,6 +12,8 @@
#undef ODB_THREADS_NONE
#undef ODB_THREADS_POSIX
#undef ODB_THREADS_WIN32
+#undef ODB_THREADS_TLS_KEYWORD
+#undef ODB_THREADS_TLS_DECLSPEC
#undef LIBODB_STATIC_LIB
diff --git a/odb/details/tls.hxx b/odb/details/tls.hxx
index 2ed68ab..2c19081 100644
--- a/odb/details/tls.hxx
+++ b/odb/details/tls.hxx
@@ -54,7 +54,33 @@ namespace odb
#elif defined(ODB_THREADS_POSIX)
# include <odb/details/posix/tls.hxx>
-# define ODB_TLS_POINTER(type) tls<type*>
+
+# ifdef ODB_THREADS_TLS_KEYWORD
+# define ODB_TLS_POINTER(type) __thread type*
+
+namespace odb
+{
+ namespace details
+ {
+ template <typename T>
+ inline T*
+ tls_get (T* p)
+ {
+ return p;
+ }
+
+ template <typename T>
+ inline void
+ tls_set (T*& rp, T* p)
+ {
+ rp = p;
+ }
+ }
+}
+
+# else
+# define ODB_TLS_POINTER(type) tls<type*>
+# endif
# define ODB_TLS_OBJECT(type) tls<type>
#elif defined(ODB_THREADS_WIN32)