25#ifndef _SB_THREAD_LOCAL_STORAGE_H_
26#define _SB_THREAD_LOCAL_STORAGE_H_
39#define SB_THREAD_INIT_CLASS(_className_,_structName_) \
40 SbThreadLocalStorage::createStorage(_className_::MT_Id, sizeof(struct _className_::_structName_), _className_::initTLSClass, _className_::exitTLSClass, OIV_FUNCTION );
48#define SB_THREAD_IS_INITIALIZED(_className_) \
49 SbThreadLocalStorage::isInitialized(_className_::MT_Id)
57#define SB_THREAD_EXIT_CLASS(_className_) \
58 SbThreadLocalStorage::deleteStorage( _className_::MT_Id, OIV_FUNCTION );
63#define GET_THREAD_LOCAL_VAR(_className_, _structName_, _varName_) \
64 ((static_cast<struct _className_::_structName_ *> (SbThreadLocalStorage::getStorage(_className_::MT_Id)))->_varName_)
69#define GET_THREAD_LOCAL_STORAGE(_className_) \
70 (static_cast<void *> (SbThreadLocalStorage::getStorage(_className_::MT_Id)))
75#define SB_THREAD_TLS_HEADER() \
78 static size_t MT_Id; \
80 static void initTLSClass(); \
82 static void exitTLSClass()
88#define SB_THREAD_TLS_SOURCE( _className_ ) \
90 size_t _className_::MT_Id = -1
94#define SoNodeTLS SbThreadLocalStorage
228 static void deleteStorage(
size_t& classThreadId,
const char* funcName=NULL );
266 static void initThreadLocalStorage();
276 static void closeThreadLocalStorage();
284 static void initClass();
290 static void exitClass();
296 template<
typename StructName,
typename ClassName>
307 template<
typename StructName,
typename ClassName>
309 getStruct(
const ClassName*)
311 return getStruct<StructName, ClassName>();
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Thread Local Sto...
static void * getStorage(const size_t classThreadId)
Returns a pointer on the storage for the given classThreadId.
static bool isInitialized(const size_t classThreadId)
Returns true if a TLS storage has already been allocated for the given classThreadId.
static void deleteStorage(size_t &classThreadId, const char *funcName=NULL)
Deletes the local storage for all threads.
static void createStorage(size_t &classThreadId, const size_t byteSize, SoInitTLSClassCB *initFunc=NULL, SoExitTLSClassCB *exitFunc=NULL, const char *funcName=NULL)
Creates or updates the local storage for the current thread.