ezEngine  Milestone 7
ezThreadLocalPointer< T > Class Template Reference

Template class to interact with thread local variables. More...

#include <ThreadLocalPointer.h>

Public Member Functions

 ezThreadLocalPointer ()
 Constructor. More...
 
 ~ezThreadLocalPointer ()
 Frees the associated thread local storage index for this variable.
 
 operator T * ()
 Returns the pointer stored in the thread pointer table for the current thread. More...
 
 operator const T * () const
 Returns the const pointer stored in the thread pointer table for the current thread. More...
 
void operator= (T *pValue)
 Assigns the pointer value to the variable for this thread. More...
 

Private Member Functions

 EZ_DISALLOW_COPY_AND_ASSIGN (ezThreadLocalPointer)
 

Private Attributes

ezUInt32 m_uiThreadLocalSlotIndex
 

Detailed Description

template<typename T>
class ezThreadLocalPointer< T >

Template class to interact with thread local variables.

The thread local variable will only store pointers to the type T given

Constructor & Destructor Documentation

template<typename T>
ezThreadLocalPointer< T >::ezThreadLocalPointer ( )
inline

Constructor.

Note
Note that the constructor doesn't allocate the TLS index since that is only safe to do after initialization of the thread local storage system and the common use case for thread local pointers is a globally shared variable (static)

Member Function Documentation

template<typename T>
ezThreadLocalPointer< T >::operator const T * ( ) const
inline

Returns the const pointer stored in the thread pointer table for the current thread.

Note
Note that a variable which hasn't been assigned yet will return NULL
template<typename T>
ezThreadLocalPointer< T >::operator T * ( )
inline

Returns the pointer stored in the thread pointer table for the current thread.

Note
Note that a variable which hasn't been assigned yet will return NULL
template<typename T>
void ezThreadLocalPointer< T >::operator= ( T *  pValue)
inline

Assigns the pointer value to the variable for this thread.

Note
Note that this triggers on first access the allocation of the TLS slot (see constructor description)

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