Inventor/threads/SbThreadLocalStorage.h File Reference

#include <Inventor/SbBase.h>
#include <Inventor/STL/vector>
#include <Inventor/threads/SbThreadSpinlock.h>
#include <Inventor/errors/SoDebugError.h>

Go to the source code of this file.

Classes

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

Defines

#define SB_THREAD_INIT_CLASS(_className_, _structName_)
#define SB_THREAD_EXIT_CLASS(_className_)
#define GET_THREAD_LOCAL_VAR(_className_, _structName_, _varName_)
#define GET_THREAD_LOCAL_STORAGE(_className_)
#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_   ) 
Value:

Returns pointer to current thread storage for defined class.

#define GET_THREAD_LOCAL_VAR ( _className_,
_structName_,
_varName_   ) 
Value:
\
  ((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_   ) 
Value:

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_   ) 
Value:
if  ( _className_::MT_Id == -1 ) \
    _className_::MT_Id = SbThreadLocalStorage::createStorage(sizeof(struct _className_::_structName_), _className_::initTLSClass, _className_::exitTLSClass, __FUNCTION__ ); \
  else \
    SoDebugError::post(__FUNCTION__,"SB_THREAD_INIT_CLASS called multiple time for class " SO__QUOTE(_className_));

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_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 12 Feb 2024
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/