Thin wrapper around posix thread local storage. Stores heap-allocated data other than Object instances. More...
#include <mitsuba/mitsuba.h>
Public Member Functions | |
PrimitiveThreadLocal () | |
Construct a new thread local storage object. More... | |
void | set (ValueType &value) |
Update the data associated with the current thread. More... | |
ValueType & | get () |
Return a reference to the data associated with the current thread. More... | |
const ValueType & | get () const |
Return a reference to the data associated with the current thread (const version) More... | |
Static Protected Member Functions | |
static void * | construct () |
static void | destruct (void *data) |
Protected Attributes | |
detail::ThreadLocalBase | m_base |
Thin wrapper around posix thread local storage. Stores heap-allocated data other than Object instances.
This class implements a thread local storage object for POD-style data structures. In comparison to an API like boost::thread_specific_ptr
it has a much nicer cleanup mechanism. Held references are destroyed when the owning thread dies or when the PrimitiveThreadLocal
instance is freed, whichever occurs first.
|
inline |
Construct a new thread local storage object.
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inline |
Return a reference to the data associated with the current thread.
|
inline |
Return a reference to the data associated with the current thread (const version)
|
inline |
Update the data associated with the current thread.
|
protected |