ATLAS Offline Software
|
A thread-local storage wrapper for the user actions. More...
#include <ThreadActionHolder.h>
Public Types | |
using | ThreadMapKey_t = std::thread::id |
using | ThreadMapVal_t = ActionType * |
using | ThreadMapHash_t = std::hash< ThreadMapKey_t > |
using | ThreadMap_t = tbb::concurrent_unordered_map< ThreadMapKey_t, ThreadMapVal_t, ThreadMapHash_t > |
using | const_iterator = typename ThreadMap_t::const_iterator |
Public Member Functions | |
~ThreadActionHolder () | |
Destructor will clean up the thread-local storage. More... | |
ActionType * | get () |
Get the object of the current thread. More... | |
void | set (std::unique_ptr< ActionType > action) |
Assign the object of the current thread. More... | |
const_iterator | begin () const |
Constant-access iteration over the action map. More... | |
const_iterator | end () const |
Constant-access iteration over the action map. More... | |
Private Attributes | |
ThreadMap_t | m_threadMap |
The wrapped thread-local storage container. More... | |
A thread-local storage wrapper for the user actions.
This container is implemented as a wrapper for a concurrent map keyed by std thread ID. It is thus fully thread-safe (in theory).
The thread-local storage is cleared in the destructor for now, at least until TBB's concurrent containers support move semantics and unique_ptr.
Definition at line 30 of file ThreadActionHolder.h.
using G4UA::ThreadActionHolder< ActionType >::const_iterator = typename ThreadMap_t::const_iterator |
Definition at line 43 of file ThreadActionHolder.h.
using G4UA::ThreadActionHolder< ActionType >::ThreadMap_t = tbb::concurrent_unordered_map < ThreadMapKey_t, ThreadMapVal_t, ThreadMapHash_t > |
Definition at line 40 of file ThreadActionHolder.h.
using G4UA::ThreadActionHolder< ActionType >::ThreadMapHash_t = std::hash<ThreadMapKey_t> |
Definition at line 38 of file ThreadActionHolder.h.
using G4UA::ThreadActionHolder< ActionType >::ThreadMapKey_t = std::thread::id |
Definition at line 35 of file ThreadActionHolder.h.
using G4UA::ThreadActionHolder< ActionType >::ThreadMapVal_t = ActionType* |
Definition at line 36 of file ThreadActionHolder.h.
|
inline |
Destructor will clean up the thread-local storage.
Would prefer to do this automatically with unique_ptr.
Definition at line 47 of file ThreadActionHolder.h.
|
inline |
Constant-access iteration over the action map.
Definition at line 69 of file ThreadActionHolder.h.
|
inline |
Constant-access iteration over the action map.
Definition at line 74 of file ThreadActionHolder.h.
|
inline |
|
inline |
Assign the object of the current thread.
Memory management must be handled manually for now.
Definition at line 63 of file ThreadActionHolder.h.
|
private |
The wrapped thread-local storage container.
Definition at line 81 of file ThreadActionHolder.h.