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 Attributes | |
std::vector< std::unique_ptr< T > > | m_held |
std::vector< typename std::thread::id > | m_thread_equivs |
std::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 1474 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1576 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1590 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
get_one
). Definition at line 1512 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1493 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1571 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
|
inline |
Definition at line 1527 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
inline |
Definition at line 1541 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
private |
Definition at line 1477 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
private |
Definition at line 1490 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.
|
private |
Definition at line 1478 of file Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h.