SbThreadLocalStorage Class Reference
[Threads]

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

#include <Inventor/threads/SbThreadLocalStorage.h>

List of all members.

Classes

class  StorageInfo

Static Public Member Functions

static size_t createStorage (const size_t byteSize, SoInitTLSClassCB *initFunc=NULL, SoExitTLSClassCB *exitFunc=NULL, const char *funcName=NULL)
static void deleteStorage (size_t id)
static void * getStorage (const size_t classThreadId)

Detailed Description

VSG extension Thread Local Storage (TLS) class.

This class allows to create thread local data storage. This allow to manage per thread static global variables in multithread mode.

Example on how to use the Thread Local Storage (TLS):

In this example we move static variables s_myStaticVar1 and s_myStaticVar2 of the class MyClass to Thread Local Storage,

SEE ALSO

SbThread, SbThreadAutoLock, SbThreadAutoReadLock, SbThreadAutoWriteLock, SbThreadBarrier, SbThreadRWMutex, SbThreadSignal


Member Function Documentation

static size_t SbThreadLocalStorage::createStorage ( const size_t  byteSize,
SoInitTLSClassCB initFunc = NULL,
SoExitTLSClassCB exitFunc = NULL,
const char *  funcName = NULL 
) [static]

Creates or updates the local storage for the current thread.

Requests that 'size' bytes of storage should be allocated for all threads for the calling class. Returns a unique Id to be used by getStorage method to access the storage.

static void SbThreadLocalStorage::deleteStorage ( size_t  id  )  [static]

Deletes the local storage for all threads.

static void* SbThreadLocalStorage::getStorage ( const size_t  classThreadId  )  [static]

Returns a pointer on the storage for the given Id.

This storage is guaranteed to be local to the current thread. The size of the storage is the same than what was requested by createStorage, unless the pointer returned is NULL.


The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 12 Feb 2024
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/