1 #ifndef fhiclcpp_types_detail_per_thread_holder_h 2 #define fhiclcpp_types_detail_per_thread_holder_h 4 #include "tbb/concurrent_hash_map.h" 13 static std::hash<std::thread::id>
const hasher{};
17 equal(std::thread::id id1, std::thread::id id2)
25 tbb::concurrent_hash_map<std::thread::id, T, thread_hash_compare>;
26 using accessor =
typename registry_t::accessor;
32 return slot_for(std::this_thread::get_id());
41 if (not registry_.insert(access_token,
id)) {
43 return access_token->second;
46 access_token->second = T{};
47 return access_token->second;
static bool equal(std::thread::id id1, std::thread::id id2)
T & slot_for(std::thread::id id)
T & slot_for_current_thread()
tbb::concurrent_hash_map< std::thread::id, T, thread_hash_compare > registry_t
typename registry_t::accessor accessor
static size_t hash(std::thread::id id)