Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::PrimitiveThreadLocal< ValueType > Class Template Reference

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
 

Detailed Description

template<typename ValueType>
class mitsuba::PrimitiveThreadLocal< ValueType >

Thin wrapper around posix thread local storage. Stores heap-allocated data other than Object instances.

See Also
ThreadLocal

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.

Constructor & Destructor Documentation

template<typename ValueType>
mitsuba::PrimitiveThreadLocal< ValueType >::PrimitiveThreadLocal ( )
inline

Construct a new thread local storage object.

Member Function Documentation

template<typename ValueType>
static void* mitsuba::PrimitiveThreadLocal< ValueType >::construct ( )
inlinestaticprotected
template<typename ValueType>
static void mitsuba::PrimitiveThreadLocal< ValueType >::destruct ( void *  data)
inlinestaticprotected
template<typename ValueType>
ValueType& mitsuba::PrimitiveThreadLocal< ValueType >::get ( )
inline

Return a reference to the data associated with the current thread.

template<typename ValueType>
const ValueType& mitsuba::PrimitiveThreadLocal< ValueType >::get ( ) const
inline

Return a reference to the data associated with the current thread (const version)

template<typename ValueType>
void mitsuba::PrimitiveThreadLocal< ValueType >::set ( ValueType &  value)
inline

Update the data associated with the current thread.

Member Data Documentation

template<typename ValueType>
detail::ThreadLocalBase mitsuba::PrimitiveThreadLocal< ValueType >::m_base
protected

The documentation for this class was generated from the following file: