A library for working with phylogenetic and population genetic data.
v0.32.0
ConcurrentQueue< T, Traits > Class Template Reference

#include <genesis/utils/threading/concurrent_queue.hpp>

Detailed Description

template<typename T, typename Traits = ConcurrentQueueDefaultTraits>
class genesis::utils::ConcurrentQueue< T, Traits >

Definition at line 562 of file concurrent_queue.hpp.

Public Member Functions

 ConcurrentQueue (ConcurrentQueue &&other) noexcept
 
 ConcurrentQueue (ConcurrentQueue const &)=delete
 
 ConcurrentQueue (size_t capacity=32 *BLOCK_SIZE)
 
 ConcurrentQueue (size_t minCapacity, size_t maxExplicitProducers, size_t maxImplicitProducers)
 
 ~ConcurrentQueue ()
 
bool enqueue (producer_token_t const &token, T &&item)
 
bool enqueue (producer_token_t const &token, T const &item)
 
bool enqueue (T &&item)
 
bool enqueue (T const &item)
 
template<typename It >
bool enqueue_bulk (It itemFirst, size_t count)
 
template<typename It >
bool enqueue_bulk (producer_token_t const &token, It itemFirst, size_t count)
 
ConcurrentQueueoperator= (ConcurrentQueue &&other) noexcept
 
ConcurrentQueueoperator= (ConcurrentQueue const &)=delete
 
size_t size_approx () const
 
void swap (ConcurrentQueue &other) noexcept
 
template<typename U >
bool try_dequeue (consumer_token_t &token, U &item)
 
template<typename U >
bool try_dequeue (U &item)
 
template<typename It >
size_t try_dequeue_bulk (consumer_token_t &token, It itemFirst, size_t max)
 
template<typename It >
size_t try_dequeue_bulk (It itemFirst, size_t max)
 
template<typename It >
size_t try_dequeue_bulk_from_producer (producer_token_t const &producer, It itemFirst, size_t max)
 
template<typename U >
bool try_dequeue_from_producer (producer_token_t const &producer, U &item)
 
template<typename U >
bool try_dequeue_non_interleaved (U &item)
 
bool try_enqueue (producer_token_t const &token, T &&item)
 
bool try_enqueue (producer_token_t const &token, T const &item)
 
bool try_enqueue (T &&item)
 
bool try_enqueue (T const &item)
 
template<typename It >
bool try_enqueue_bulk (It itemFirst, size_t count)
 
template<typename It >
bool try_enqueue_bulk (producer_token_t const &token, It itemFirst, size_t count)
 

Static Public Member Functions

static constexpr bool is_lock_free ()
 

Public Types

typedef ConsumerToken consumer_token_t
 
typedef Traits::index_t index_t
 
typedef ProducerToken producer_token_t
 
typedef Traits::size_t size_t
 

Static Public Attributes

static const size_t BLOCK_SIZE = static_cast<size_t>(Traits::BLOCK_SIZE)
 
static const size_t EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD = static_cast<size_t>(Traits::EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD)
 
static const std::uint32_t EXPLICIT_CONSUMER_CONSUMPTION_QUOTA_BEFORE_ROTATE = static_cast<std::uint32_t>(Traits::EXPLICIT_CONSUMER_CONSUMPTION_QUOTA_BEFORE_ROTATE)
 
static const size_t EXPLICIT_INITIAL_INDEX_SIZE = static_cast<size_t>(Traits::EXPLICIT_INITIAL_INDEX_SIZE)
 
static const size_t IMPLICIT_INITIAL_INDEX_SIZE = static_cast<size_t>(Traits::IMPLICIT_INITIAL_INDEX_SIZE)
 
static const size_t INITIAL_IMPLICIT_PRODUCER_HASH_SIZE = static_cast<size_t>(Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE)
 
static const size_t MAX_SUBQUEUE_SIZE = (details::const_numeric_max<size_t>::value - static_cast<size_t>(Traits::MAX_SUBQUEUE_SIZE) < BLOCK_SIZE) ? details::const_numeric_max<size_t>::value : ((static_cast<size_t>(Traits::MAX_SUBQUEUE_SIZE) + (BLOCK_SIZE - 1)) / BLOCK_SIZE * BLOCK_SIZE)
 

Friends

class ConcurrentQueueTests
 
struct ConsumerToken
 
struct ExplicitProducer
 
struct ImplicitProducer
 
struct ProducerToken
 
template<typename XT , typename XTraits >
void swap (typename ConcurrentQueue< XT, XTraits >::ImplicitProducerKVP &, typename ConcurrentQueue< XT, XTraits >::ImplicitProducerKVP &) noexcept
 

Constructor & Destructor Documentation

◆ ConcurrentQueue() [1/4]

ConcurrentQueue ( size_t  capacity = 32 * BLOCK_SIZE)
inlineexplicit

Definition at line 984 of file concurrent_queue.hpp.

◆ ConcurrentQueue() [2/4]

ConcurrentQueue ( size_t  minCapacity,
size_t  maxExplicitProducers,
size_t  maxImplicitProducers 
)
inline

Definition at line 1008 of file concurrent_queue.hpp.

◆ ~ConcurrentQueue()

~ConcurrentQueue ( )
inline

Definition at line 1029 of file concurrent_queue.hpp.

◆ ConcurrentQueue() [3/4]

ConcurrentQueue ( ConcurrentQueue< T, Traits > const &  )
delete

◆ ConcurrentQueue() [4/4]

ConcurrentQueue ( ConcurrentQueue< T, Traits > &&  other)
inlinenoexcept

Definition at line 1083 of file concurrent_queue.hpp.

Member Function Documentation

◆ enqueue() [1/4]

bool enqueue ( producer_token_t const &  token,
T &&  item 
)
inline

Definition at line 1199 of file concurrent_queue.hpp.

◆ enqueue() [2/4]

bool enqueue ( producer_token_t const &  token,
T const &  item 
)
inline

Definition at line 1190 of file concurrent_queue.hpp.

◆ enqueue() [3/4]

bool enqueue ( T &&  item)
inline

Definition at line 1179 of file concurrent_queue.hpp.

◆ enqueue() [4/4]

bool enqueue ( T const &  item)
inline

Definition at line 1167 of file concurrent_queue.hpp.

◆ enqueue_bulk() [1/2]

bool enqueue_bulk ( It  itemFirst,
size_t  count 
)
inline

Definition at line 1211 of file concurrent_queue.hpp.

◆ enqueue_bulk() [2/2]

bool enqueue_bulk ( producer_token_t const &  token,
It  itemFirst,
size_t  count 
)
inline

Definition at line 1225 of file concurrent_queue.hpp.

◆ is_lock_free()

static constexpr bool is_lock_free ( )
inlinestaticconstexpr

Definition at line 1510 of file concurrent_queue.hpp.

◆ operator=() [1/2]

ConcurrentQueue& operator= ( ConcurrentQueue< T, Traits > &&  other)
inlinenoexcept

Definition at line 1117 of file concurrent_queue.hpp.

◆ operator=() [2/2]

ConcurrentQueue& operator= ( ConcurrentQueue< T, Traits > const &  )
delete

◆ size_approx()

size_t size_approx ( ) const
inline

Definition at line 1498 of file concurrent_queue.hpp.

◆ swap()

void swap ( ConcurrentQueue< T, Traits > &  other)
inlinenoexcept

Definition at line 1127 of file concurrent_queue.hpp.

◆ try_dequeue() [1/2]

bool try_dequeue ( consumer_token_t token,
U &  item 
)
inline

Definition at line 1359 of file concurrent_queue.hpp.

◆ try_dequeue() [2/2]

bool try_dequeue ( U &  item)
inline

Definition at line 1301 of file concurrent_queue.hpp.

◆ try_dequeue_bulk() [1/2]

size_t try_dequeue_bulk ( consumer_token_t token,
It  itemFirst,
size_t  max 
)
inline

Definition at line 1425 of file concurrent_queue.hpp.

◆ try_dequeue_bulk() [2/2]

size_t try_dequeue_bulk ( It  itemFirst,
size_t  max 
)
inline

Definition at line 1407 of file concurrent_queue.hpp.

◆ try_dequeue_bulk_from_producer()

size_t try_dequeue_bulk_from_producer ( producer_token_t const &  producer,
It  itemFirst,
size_t  max 
)
inline

Definition at line 1487 of file concurrent_queue.hpp.

◆ try_dequeue_from_producer()

bool try_dequeue_from_producer ( producer_token_t const &  producer,
U &  item 
)
inline

Definition at line 1474 of file concurrent_queue.hpp.

◆ try_dequeue_non_interleaved()

bool try_dequeue_non_interleaved ( U &  item)
inline

Definition at line 1344 of file concurrent_queue.hpp.

◆ try_enqueue() [1/4]

bool try_enqueue ( producer_token_t const &  token,
T &&  item 
)
inline

Definition at line 1265 of file concurrent_queue.hpp.

◆ try_enqueue() [2/4]

bool try_enqueue ( producer_token_t const &  token,
T const &  item 
)
inline

Definition at line 1257 of file concurrent_queue.hpp.

◆ try_enqueue() [3/4]

bool try_enqueue ( T &&  item)
inline

Definition at line 1247 of file concurrent_queue.hpp.

◆ try_enqueue() [4/4]

bool try_enqueue ( T const &  item)
inline

Definition at line 1235 of file concurrent_queue.hpp.

◆ try_enqueue_bulk() [1/2]

bool try_enqueue_bulk ( It  itemFirst,
size_t  count 
)
inline

Definition at line 1278 of file concurrent_queue.hpp.

◆ try_enqueue_bulk() [2/2]

bool try_enqueue_bulk ( producer_token_t const &  token,
It  itemFirst,
size_t  count 
)
inline

Definition at line 1291 of file concurrent_queue.hpp.

Friends And Related Function Documentation

◆ ConcurrentQueueTests

friend class ConcurrentQueueTests
friend

Definition at line 1522 of file concurrent_queue.hpp.

◆ ConsumerToken

friend struct ConsumerToken
friend

Definition at line 1517 of file concurrent_queue.hpp.

◆ ExplicitProducer

friend struct ExplicitProducer
friend

Definition at line 1518 of file concurrent_queue.hpp.

◆ ImplicitProducer

friend struct ImplicitProducer
friend

Definition at line 1520 of file concurrent_queue.hpp.

◆ ProducerToken

friend struct ProducerToken
friend

Definition at line 1516 of file concurrent_queue.hpp.

◆ swap

void swap ( typename ConcurrentQueue< XT, XTraits >::ImplicitProducerKVP &  ,
typename ConcurrentQueue< XT, XTraits >::ImplicitProducerKVP &   
)
friend

Member Typedef Documentation

◆ consumer_token_t

Definition at line 942 of file concurrent_queue.hpp.

◆ index_t

typedef Traits::index_t index_t

Definition at line 944 of file concurrent_queue.hpp.

◆ producer_token_t

Definition at line 941 of file concurrent_queue.hpp.

◆ size_t

typedef Traits::size_t size_t

Definition at line 945 of file concurrent_queue.hpp.

Member Data Documentation

◆ BLOCK_SIZE

const size_t BLOCK_SIZE = static_cast<size_t>(Traits::BLOCK_SIZE)
static

Definition at line 947 of file concurrent_queue.hpp.

◆ EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD

const size_t EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD = static_cast<size_t>(Traits::EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD)
static

Definition at line 948 of file concurrent_queue.hpp.

◆ EXPLICIT_CONSUMER_CONSUMPTION_QUOTA_BEFORE_ROTATE

const std::uint32_t EXPLICIT_CONSUMER_CONSUMPTION_QUOTA_BEFORE_ROTATE = static_cast<std::uint32_t>(Traits::EXPLICIT_CONSUMER_CONSUMPTION_QUOTA_BEFORE_ROTATE)
static

Definition at line 952 of file concurrent_queue.hpp.

◆ EXPLICIT_INITIAL_INDEX_SIZE

const size_t EXPLICIT_INITIAL_INDEX_SIZE = static_cast<size_t>(Traits::EXPLICIT_INITIAL_INDEX_SIZE)
static

Definition at line 949 of file concurrent_queue.hpp.

◆ IMPLICIT_INITIAL_INDEX_SIZE

const size_t IMPLICIT_INITIAL_INDEX_SIZE = static_cast<size_t>(Traits::IMPLICIT_INITIAL_INDEX_SIZE)
static

Definition at line 950 of file concurrent_queue.hpp.

◆ INITIAL_IMPLICIT_PRODUCER_HASH_SIZE

const size_t INITIAL_IMPLICIT_PRODUCER_HASH_SIZE = static_cast<size_t>(Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE)
static

Definition at line 951 of file concurrent_queue.hpp.

◆ MAX_SUBQUEUE_SIZE

const size_t MAX_SUBQUEUE_SIZE = (details::const_numeric_max<size_t>::value - static_cast<size_t>(Traits::MAX_SUBQUEUE_SIZE) < BLOCK_SIZE) ? details::const_numeric_max<size_t>::value : ((static_cast<size_t>(Traits::MAX_SUBQUEUE_SIZE) + (BLOCK_SIZE - 1)) / BLOCK_SIZE * BLOCK_SIZE)
static

Definition at line 958 of file concurrent_queue.hpp.


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