Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SbThreadLocalStorage.h File Reference
#include <Inventor/SbBase.h>

Go to the source code of this file.

Classes

class  SbThreadLocalStorage
  VSG extension Thread Local Storage (TLS) class. More...
 

Macros

#define SB_THREAD_INIT_CLASS(_className_, _structName_)    SbThreadLocalStorage::createStorage(_className_::MT_Id, sizeof(struct _className_::_structName_), _className_::initTLSClass, _className_::exitTLSClass, OIV_FUNCTION );
 Requests allocation of thread local storage.
 
#define SB_THREAD_IS_INITIALIZED(_className_)    SbThreadLocalStorage::isInitialized(_className_::MT_Id)
 Returns true if a TLS storage has been allocated for the given classThreadId.
 
#define SB_THREAD_EXIT_CLASS(_className_)    SbThreadLocalStorage::deleteStorage( _className_::MT_Id, OIV_FUNCTION );
 Requests deallocation of thread local storage.
 
#define GET_THREAD_LOCAL_VAR(_className_, _structName_, _varName_)    ((static_cast<struct _className_::_structName_ *> (SbThreadLocalStorage::getStorage(_className_::MT_Id)))->_varName_)
 Gets direct access to current thread storage inside variable.
 
#define GET_THREAD_LOCAL_STORAGE(_className_)    (static_cast<void *> (SbThreadLocalStorage::getStorage(_className_::MT_Id)))
 Returns pointer to current thread storage for defined class.
 
#define SB_THREAD_TLS_HEADER()
 Defines headers for required member variables in thread storage management.
 
#define SB_THREAD_TLS_SOURCE(_className_)
 Defines source for required member variables in thread storage management.
 
#define SoNodeTLS   SbThreadLocalStorage
 Compatiblity define SoNodeTLS to SbThreadLocalStorage.
 

Typedefs

typedef void SoInitTLSClassCB()
 
typedef void SoExitTLSClassCB()
 

Macro Definition Documentation

◆ GET_THREAD_LOCAL_STORAGE

#define GET_THREAD_LOCAL_STORAGE (   _className_)     (static_cast<void *> (SbThreadLocalStorage::getStorage(_className_::MT_Id)))

Returns pointer to current thread storage for defined class.

Definition at line 69 of file SbThreadLocalStorage.h.

◆ GET_THREAD_LOCAL_VAR

#define GET_THREAD_LOCAL_VAR (   _className_,
  _structName_,
  _varName_ 
)     ((static_cast<struct _className_::_structName_ *> (SbThreadLocalStorage::getStorage(_className_::MT_Id)))->_varName_)

Gets direct access to current thread storage inside variable.

Definition at line 63 of file SbThreadLocalStorage.h.

◆ SB_THREAD_EXIT_CLASS

#define SB_THREAD_EXIT_CLASS (   _className_)     SbThreadLocalStorage::deleteStorage( _className_::MT_Id, OIV_FUNCTION );

Requests deallocation of thread local storage.

This macro should be called within exitClass(). The structName argument should be the structure (the type name) defining what size of memory should be allocated for each thread, for this class

Definition at line 57 of file SbThreadLocalStorage.h.

◆ SB_THREAD_INIT_CLASS

#define SB_THREAD_INIT_CLASS (   _className_,
  _structName_ 
)     SbThreadLocalStorage::createStorage(_className_::MT_Id, sizeof(struct _className_::_structName_), _className_::initTLSClass, _className_::exitTLSClass, OIV_FUNCTION );

Requests allocation of thread local storage.

This macro should be called within initClass(). The structName argument should be the structure (the type name) defining what size of memory should be allocated for each thread, for this class

Definition at line 39 of file SbThreadLocalStorage.h.

◆ SB_THREAD_IS_INITIALIZED

#define SB_THREAD_IS_INITIALIZED (   _className_)     SbThreadLocalStorage::isInitialized(_className_::MT_Id)

Returns true if a TLS storage has been allocated for the given classThreadId.

This MACRO is used in exitTLSClass() implementation to avoid calling getStorage() which will create the TLS if not found, which is useless as the purpose of exitTLSClass() is to delete associated resources.

Definition at line 48 of file SbThreadLocalStorage.h.

◆ SB_THREAD_TLS_HEADER

#define SB_THREAD_TLS_HEADER ( )
Value:
private: \ \
static size_t MT_Id; \ \
static void initTLSClass(); \ \
static void exitTLSClass()

Defines headers for required member variables in thread storage management.

Definition at line 75 of file SbThreadLocalStorage.h.

◆ SB_THREAD_TLS_SOURCE

#define SB_THREAD_TLS_SOURCE (   _className_)
Value:
\
size_t _className_::MT_Id = -1

Defines source for required member variables in thread storage management.

Definition at line 88 of file SbThreadLocalStorage.h.

◆ SoNodeTLS

#define SoNodeTLS   SbThreadLocalStorage

Compatiblity define SoNodeTLS to SbThreadLocalStorage.

Definition at line 94 of file SbThreadLocalStorage.h.

Typedef Documentation

◆ SoExitTLSClassCB

typedef void SoExitTLSClassCB()

Definition at line 31 of file SbThreadLocalStorage.h.

◆ SoInitTLSClassCB

typedef void SoInitTLSClassCB()

Definition at line 30 of file SbThreadLocalStorage.h.