5#ifndef G4ATLASTOOLS_THREADLOCALHOLDER_H
6#define G4ATLASTOOLS_THREADLOCALHOLDER_H
29#include "tbb/concurrent_unordered_map.h"
57 tbb::concurrent_unordered_map< MapKey_t, MapVal_t, MapHash_t >;
61 auto itr =
m_threadMap.find( std::this_thread::get_id() );
68 const auto tid = std::this_thread::get_id();
99 delete mapPair.second;
A thread-local storage wrapper.
std::hash< MapKey_t > MapHash_t
T * get()
Get the object of the current thread.
void set(T *obj)
Assign the object of the current thread.
ThreadMap_t m_threadMap
The wrapped thread-local storage container.
const ThreadMap_t & getMap() const
Constant access for iteration, etc.
tbb::concurrent_unordered_map< MapKey_t, MapVal_t, MapHash_t > ThreadMap_t
A ThreadLocalHolder which owns its objects.
~ThreadLocalOwner()
Destructor will clean up the storage.