20 template <
class T,
void (*D)(T*)>
22 : tls_((
TLS::ThreadDestructor_t)D)
26 template <
class T,
void (*D)(T*)>
31 template <
class T,
void (*D)(T*)>
34 tls_.
set(static_cast<const void*>(data));
38 template <
class T,
void (*D)(T*)>
41 tls_.
set(rhs.tls_.get());
45 template <
class T,
void (*D)(T*)>
48 return static_cast<T*
>(tls_.
get());
51 template <
class T,
void (*D)(T*)>
54 return static_cast<const T*
>(tls_.
get());
57 template <
class T,
void (*D)(T*)>
60 return static_cast<T*
>(tls_.
get());
63 template <
class T,
void (*D)(T*)>
66 return static_cast<T*
>(tls_.
get());
69 template <
class T,
void (*D)(T*)>
72 return tls_.
get() == 0;
75 template <
class T,
void (*D)(T*)>
78 return tls_.
get() != 0;
PerThread()
Construct a new per-thread variable.
PerThread< T, D > & operator=(const T *data)
Assign an object to the thread-local storage.
~PerThread()
Destruct the per-thread variable.
void set(const void *data)
Set the data for this thread-local storage.
Implements thread-specific storage for C++ objects.
T * operator->()
Access the thread-local object.
Abstraction layer and common utilities for multi-threaded programming.
Provides thread-local storage API used by PerThread and PerThreadRef.