ATLAS Offline Software
|
A thread-local storage wrapper. More...
#include <ThreadLocalHolder.h>
Public Types | |
using | MapKey_t = std::thread::id |
using | MapVal_t = T * |
using | MapHash_t = std::hash< MapKey_t > |
using | ThreadMap_t = tbb::concurrent_unordered_map< MapKey_t, MapVal_t, MapHash_t > |
Public Member Functions | |
T * | get () |
Get the object of the current thread. More... | |
void | set (T *obj) |
Assign the object of the current thread. More... | |
const ThreadMap_t & | getMap () const |
Constant access for iteration, etc. More... | |
Protected Attributes | |
ThreadMap_t | m_threadMap |
The wrapped thread-local storage container. More... | |
A thread-local storage wrapper.
This container is implemented as a wrapper for a concurrent map keyed by std thread ID. It is thus fully thread-safe (in theory).
This container is non-owning. It doesn't clean up memory. For a corresponding container which owns its objects, see ThreadLocalOwner.
Definition at line 48 of file ThreadLocalHolder.h.
using thread_utils::ThreadLocalHolder< T >::MapHash_t = std::hash<MapKey_t> |
Definition at line 55 of file ThreadLocalHolder.h.
using thread_utils::ThreadLocalHolder< T >::MapKey_t = std::thread::id |
Definition at line 53 of file ThreadLocalHolder.h.
using thread_utils::ThreadLocalHolder< T >::MapVal_t = T* |
Definition at line 54 of file ThreadLocalHolder.h.
using thread_utils::ThreadLocalHolder< T >::ThreadMap_t = tbb::concurrent_unordered_map< MapKey_t, MapVal_t, MapHash_t > |
Definition at line 56 of file ThreadLocalHolder.h.
|
inline |
|
inline |
Constant access for iteration, etc.
Definition at line 73 of file ThreadLocalHolder.h.
|
inline |
|
protected |
The wrapped thread-local storage container.
Definition at line 80 of file ThreadLocalHolder.h.