|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef G4ATLASTOOLS__G4UA_THREADACTIONHOLDER_H
6 #define G4ATLASTOOLS__G4UA_THREADACTIONHOLDER_H
14 #include "tbb/concurrent_unordered_map.h"
29 template<
class ActionType>
49 delete mapPair.second;
56 auto mapPair =
m_threadMap.find( std::this_thread::get_id() );
58 return mapPair->second;
64 const auto tid = std::this_thread::get_id();
const_iterator begin() const
Constant-access iteration over the action map.
tbb::concurrent_unordered_map< ThreadMapKey_t, ThreadMapVal_t, ThreadMapHash_t > ThreadMap_t
~ThreadActionHolder()
Destructor will clean up the thread-local storage.
void set(std::unique_ptr< ActionType > action)
Assign the object of the current thread.
typename ThreadMap_t::const_iterator const_iterator
std::thread::id ThreadMapKey_t
const_iterator end() const
Constant-access iteration over the action map.
std::hash< ThreadMapKey_t > ThreadMapHash_t
ActionType * ThreadMapVal_t
A thread-local storage wrapper for the user actions.
ATLAS subclass of the G4 event action.
ActionType * get()
Get the object of the current thread.
ThreadMap_t m_threadMap
The wrapped thread-local storage container.