![]() |
Public API Reference |
![]() |
Thread local storage of a pointer value (void*). More...
#include <csutil/threading/tls.h>
Public Types | |
typedef void(* | DestructorFn )(void *) |
TLS value destructor function. | |
Public Member Functions | |
void * | GetValue () const |
Get the TLS slot value for the current thread. Defaults to 0. | |
void | SetValue (void *data) const |
Set the TLS slot value for the current thread. | |
ThreadLocalBase (DestructorFn dtor=0) | |
Create a TLS slot with the given destructor function. | |
~ThreadLocalBase () | |
Delete the TLS slot. |
Thread local storage of a pointer value (void*).
Wraps the platform-specific TLS details.
Optionally, a "destructor" function can be specified which is called when the thread exists and the TLS value for the thread is not null. Note it's called only on thread exit, not when the TLS slot itself is destroyed! (Essentially, the same as pthreads behaves.)
typedef void(* CS::Threading::ThreadLocalBase::DestructorFn)(void *) |
Create a TLS slot with the given destructor function.
Delete the TLS slot.
void* CS::Threading::ThreadLocalBase::GetValue | ( | ) | const |
Get the TLS slot value for the current thread. Defaults to 0.
void CS::Threading::ThreadLocalBase::SetValue | ( | void * | data | ) | const |
Set the TLS slot value for the current thread.