summaryrefslogtreecommitdiff
path: root/odb/details/win32/tls.txx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-01-24 16:53:38 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-01-24 16:53:38 +0300
commit26e36b3a9d7b49d46ecfa69b447482251acba8ac (patch)
tree5436b7857fae9aee50d018ea0eef35a529fc03e4 /odb/details/win32/tls.txx
parent0074faad1b27f3cd52a606c438e4f1375956d731 (diff)
Turn libodb repository into package for muti-package repositorylibodb
Diffstat (limited to 'odb/details/win32/tls.txx')
-rw-r--r--odb/details/win32/tls.txx94
1 files changed, 0 insertions, 94 deletions
diff --git a/odb/details/win32/tls.txx b/odb/details/win32/tls.txx
deleted file mode 100644
index 96bed4c..0000000
--- a/odb/details/win32/tls.txx
+++ /dev/null
@@ -1,94 +0,0 @@
-// file : odb/details/win32/tls.txx
-// license : GNU GPL v2; see accompanying LICENSE file
-
-#include <odb/details/unique-ptr.hxx>
-#include <odb/details/win32/exceptions.hxx>
-
-namespace odb
-{
- namespace details
- {
- // tls<T>
- //
- template <typename T>
- win32_once_t tls<T>::once_= WIN32_ONCE_INIT;
-
- template <typename T>
- size_t tls<T>::key_;
-
- template <typename T>
- T& tls<T>::
- get () const
- {
- win32_once (once_, key_init);
-
- if (void* v = _get (key_))
- return *static_cast<T*> (v);
-
- unique_ptr<T> p (new T);
- _set (key_, p.get ());
-
- T& r (*p);
- p.release ();
- return r;
- }
-
- template <typename T>
- void tls<T>::
- free ()
- {
- win32_once (once_, key_init);
-
- if (void* v = _get (key_))
- {
- _set (key_, 0);
- delete static_cast<T*> (v);
- }
- }
-
- template <typename T>
- void tls<T>::
- key_init ()
- {
- key_ = _allocate (destructor);
- }
-
- template <typename T>
- void tls<T>::
- destructor (void* v)
- {
- delete static_cast<T*> (v);
- }
-
- // tls<T*>
- //
- template <typename T>
- win32_once_t tls<T*>::once_ = WIN32_ONCE_INIT;
-
- template <typename T>
- size_t tls<T*>::key_;
-
- template <typename T>
- T* tls<T*>::
- get () const
- {
- win32_once (once_, key_init);
- return static_cast<T*> (_get (key_));
- }
-
- template <typename T>
- void tls<T*>::
- set (T* p)
- {
- win32_once (once_, key_init);
- _set (key_, p);
- }
-
- template <typename T>
- void tls<T*>::
- key_init ()
- {
- key_ = _allocate (0);
- }
- }
-}