Inventor/threads/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...

Defines

#define SB_THREAD_INIT_CLASS(_className_, _structName_)   SbThreadLocalStorage::createStorage(_className_::MT_Id, sizeof(struct _className_::_structName_), _className_::initTLSClass, _className_::exitTLSClass, OIV_FUNCTION );
#define SB_THREAD_IS_INITIALIZED(_className_)   SbThreadLocalStorage::isInitialized(_className_::MT_Id)
#define SB_THREAD_EXIT_CLASS(_className_)   SbThreadLocalStorage::deleteStorage( _className_::MT_Id, OIV_FUNCTION );
#define GET_THREAD_LOCAL_VAR(_className_, _structName_, _varName_)   ((static_cast<struct _className_::_structName_ *> (SbThreadLocalStorage::getStorage(_className_::MT_Id)))->_varName_)
#define GET_THREAD_LOCAL_STORAGE(_className_)   (static_cast<void *> (SbThreadLocalStorage::getStorage(_className_::MT_Id)))
#define SB_THREAD_TLS_HEADER()
#define SB_THREAD_TLS_SOURCE(_className_)
#define SoNodeTLS   SbThreadLocalStorage

Typedefs

typedef void SoInitTLSClassCB ()
typedef void SoExitTLSClassCB ()

Define Documentation

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

Returns pointer to current thread storage for defined class.

#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 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

#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

#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.

 
#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.

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

TLS storage unique id.

TLS storage initialization method TLS storage cleanup method Defines source for required member variables in thread storage management.

#define SoNodeTLS   SbThreadLocalStorage

Unique Id to reference access TLS data associated to this class through getStorage method.

Compatiblity define SoNodeTLS to SbThreadLocalStorage.


Typedef Documentation

typedef void SoExitTLSClassCB()
typedef void SoInitTLSClassCB()

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/