25#ifndef _SB_THREAD_LOCAL_STORAGE_H_
26#define _SB_THREAD_LOCAL_STORAGE_H_
28#include <Inventor/SbBase.h>
44#define SB_THREAD_INIT_CLASS(_className_,_structName_) \
45 SbThreadLocalStorage::createStorage(_className_::MT_Id, sizeof(struct _className_::_structName_), _className_::initTLSClass, _className_::exitTLSClass, OIV_FUNCTION );
56#define SB_THREAD_IS_INITIALIZED(_className_) \
57 SbThreadLocalStorage::isInitialized(_className_::MT_Id)
68#define SB_THREAD_EXIT_CLASS(_className_) \
69 SbThreadLocalStorage::deleteStorage( _className_::MT_Id, OIV_FUNCTION );
76#define GET_THREAD_LOCAL_VAR(_className_, _structName_, _varName_) \
77 ((static_cast<struct _className_::_structName_ *> (SbThreadLocalStorage::getStorage(_className_::MT_Id)))->_varName_)
84#define GET_THREAD_LOCAL_STORAGE(_className_) \
85 (static_cast<void *> (SbThreadLocalStorage::getStorage(_className_::MT_Id)))
92#define SB_THREAD_TLS_HEADER() \
95 static size_t MT_Id; \
97 static void initTLSClass(); \
99 static void exitTLSClass()
107#define SB_THREAD_TLS_SOURCE( _className_ ) \
109 size_t _className_::MT_Id = -1
117#define SoNodeTLS SbThreadLocalStorage
251 static void deleteStorage(
size_t& classThreadId,
const char* funcName=NULL );
289 static void initThreadLocalStorage();
299 static void closeThreadLocalStorage();
307 static void initClass();
313 static void exitClass();
319 template<
typename StructName,
typename ClassName>
330 template<
typename StructName,
typename ClassName>
332 getStruct(
const ClassName*)
334 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.