![]() |
ATLAS Offline Software
|
Manages objects of type T
in a thread-safe way, ensuring that there's an object available for each separate thread while minimizing the number of allocations.
More...
#include <Helpers.h>
Public Member Functions | |
T & | get_one () |
T & | get_for_thread () const |
void | release_one () |
void | resize (const size_t new_size) |
template<class F , class ... Args> | |
void | operate_on_all (F &&f, Args &&... args) |
size_t | held_size () const |
size_t | available_size () const |
size_t | filled_size () const |
Private Member Functions | |
T & | add_one_and_return () |
Private Attributes | |
std::vector< std::unique_ptr< T > > | m_held |
std::vector< typename std::thread::id > | m_thread_equivs |
std::shared_mutex | m_mutex |
Manages objects of type T
in a thread-safe way, ensuring that there's an object available for each separate thread while minimizing the number of allocations.
Internally uses a std::vector
of std::thread::id
to manage the different threads, thus it is especially efficient for relatively small numbers of concurrent threads (which matches the use case, e. g. 64 threads )
Definition at line 1479 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inlineprivate |
Definition at line 1497 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1591 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1606 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
get_one
). Definition at line 1525 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1506 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1585 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
|
inline |
Definition at line 1541 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1555 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
private |
Definition at line 1482 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
mutableprivate |
Definition at line 1495 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
private |
Definition at line 1483 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.