Collaboration diagram for ThreadLocalStorage:
Data Structures | |
class | ThreadLocal< T > |
Typedefs | |
typedef void(*) | ThreadLocalDtor (void *) |
A pointer to a function used to free a piece of thread local storage. | |
typedef size_t | TLSKey |
A key used to access thread local storage. | |
Functions | |
LDK_TLS_API TLSKey | threadLocalCreateKey (ThreadLocalDtor dtor=NULL) |
Create a key for thread local storage. | |
LDK_TLS_API void | threadLocalSet (TLSKey key, void *object) |
Associate an object with a key for the current thread. | |
LDK_TLS_API void * | threadLocalGet (TLSKey key) |
Get the object associated with key for the current thread. |
Each thread possesses a private memory block, the thread-local data area (TLD). This area is indexed by TLS keys. The TLD area associates values of type void * to TLS keys. TLS keys are common to all threads, but the value associated with a given TLS key can be different in each thread.
For concreteness, the TLS areas can be viewed as arrays of void * pointers, TLS keys as integer indices into these arrays, and the value of a TLS key as the value of the corresponding array element in the calling thread.
When a thread is created, its TLS area initially associates NULL with all keys. This behavior is undocumented on MS Windows.
This description was adapted from the pthread_key_create GNU-Linux manpage.
TLSKey threadLocalCreateKey | ( | ThreadLocalDtor | dtor = NULL |
) |
dtor | A pointer to a function to free a piece of thread local storage. |
Referenced by LDK::GenericXmlBinding< const char * >::GenericXmlBinding(), LDK::TLSSingletonStorage< T >::initialise(), and ThreadLocal< T >::ThreadLocal().
void * threadLocalGet | ( | TLSKey | key | ) |
key | The unique identifier associated with an object in the current thread. |
Referenced by LDK::GenericXmlBinding< const char * >::fromXml(), LDK::TLSSingletonStorage< T >::instance(), ThreadLocal< T >::operator &(), and ThreadLocal< T >::operator->().
void threadLocalSet | ( | TLSKey | key, | |
void * | object | |||
) |
key | The unique identifier associated with an object in the current thread. | |
object | The object to associate with key in the current thread. |
Referenced by LDK::GenericXmlBinding< const char * >::fromXml(), LDK::TLSSingletonStorage< T >::instance(), ThreadLocal< T >::operator &(), and ThreadLocal< T >::operator->().