JANA2
JResourcePool< DType > Class Template Reference

Public Member Functions

 JResourcePool (std::size_t sMaxPoolSize, std::size_t sDebugLevel)
 
 JResourcePool (const JResourcePool &)=delete
 
JResourcePooloperator= (const JResourcePool &)=delete
 
 JResourcePool (JResourcePool &&)=delete
 
JResourcePooloperator= (JResourcePool &&)=delete
 
void Set_ControlParams (std::size_t sMaxPoolSize, std::size_t sDebugLevel)
 
std::size_t Get_MaxPoolSize (void)
 
template<typename... ConstructorArgTypes>
DType * Get_Resource (ConstructorArgTypes &&...aConstructorArgs)
 
template<typename ContainerType , typename... ConstructorArgTypes>
void Get_Resources (std::size_t aNumResources, std::back_insert_iterator< ContainerType > aInsertIterator, ConstructorArgTypes &&...aConstructorArgs)
 
template<typename... ConstructorArgTypes>
std::shared_ptr< DType > Get_SharedResource (ConstructorArgTypes &&...aConstructorArgs)
 
template<typename ContainerType , typename... ConstructorArgTypes>
void Get_SharedResources (std::size_t aNumResources, std::back_insert_iterator< ContainerType > aInsertIterator, ConstructorArgTypes &&...aConstructorArgs)
 
void Recycle (const DType *sResource)
 
void Recycle (std::vector< const DType * > &sResources)
 
void Recycle (DType *sResource)
 
void Recycle (std::vector< DType * > &sResources)
 
std::size_t Get_PoolSize (void) const
 
std::size_t Get_NumObjectsAllThreads (void) const
 

Static Public Member Functions

static constexpr unsigned int Get_CacheLineSize (void)
 

Member Function Documentation

template<typename DType>
static constexpr unsigned int JResourcePool< DType >::Get_CacheLineSize ( void  )
inlinestatic

Returns the cache line size for the processor of the target platform.

The cache line size is useful for creating a buffer to make sure that a variable accessed by multiple threads does not share the cache line it is on. This is useful for variables that may be written-to by one of the threads, because the thread will acquire locked access to the entire cache line. This blocks other threads from operating on the other data stored on the cache line. Note that it is also important to align the shared data as well. See http://www.drdobbs.com/parallel/eliminate-false-sharing/217500206?pgno=4 for more details.


The documentation for this class was generated from the following file: