aboutsummaryrefslogtreecommitdiff
path: root/odb/details
diff options
context:
space:
mode:
Diffstat (limited to 'odb/details')
-rw-r--r--odb/details/config.h.in2
-rw-r--r--odb/details/tls.hxx28
2 files changed, 29 insertions, 1 deletions
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)