![]() |
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 1472 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inlineprivate |
Definition at line 1490 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1584 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1599 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
get_one
). Definition at line 1518 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1499 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1578 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
|
inline |
Definition at line 1534 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1548 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
private |
Definition at line 1475 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
mutableprivate |
Definition at line 1488 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
private |
Definition at line 1476 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.