Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
A high-performance thread-safe non-blocking concurrent queue. More...
#include <concurrent_queue.h>
Public Types | |
typedef T | value_type |
Element type in the queue. More... | |
typedef T & | reference |
Reference type. More... | |
typedef const T & | const_reference |
Const reference type. More... | |
typedef size_t | size_type |
Integral type for representing size of the queue. More... | |
typedef ptrdiff_t | difference_type |
Difference type for iterator. More... | |
typedef A | allocator_type |
Allocator type. More... | |
typedef internal::concurrent_queue_iterator< concurrent_queue, T > | iterator |
typedef internal::concurrent_queue_iterator< concurrent_queue, const T > | const_iterator |
Public Member Functions | |
concurrent_queue (const allocator_type &a=allocator_type()) | |
Construct empty queue. More... | |
template<typename InputIterator > | |
concurrent_queue (InputIterator begin, InputIterator end, const allocator_type &a=allocator_type()) | |
[begin,end) constructor More... | |
concurrent_queue (const concurrent_queue &src, const allocator_type &a=allocator_type()) | |
Copy constructor. More... | |
concurrent_queue (concurrent_queue &&src) | |
Move constructors. More... | |
concurrent_queue (concurrent_queue &&src, const allocator_type &a) | |
~concurrent_queue () | |
Destroy queue. More... | |
void | push (const T &source) |
Enqueue an item at tail of queue. More... | |
void | push (T &&source) |
template<typename... Arguments> | |
void | emplace (Arguments &&... args) |
bool | try_pop (T &result) |
Attempt to dequeue an item from head of queue. More... | |
size_type | unsafe_size () const |
Return the number of items in the queue; thread unsafe. More... | |
bool | empty () const |
Equivalent to size()==0. More... | |
void | clear () |
Clear the queue. not thread-safe. More... | |
allocator_type | get_allocator () const |
Return allocator object. More... | |
iterator | unsafe_begin () |
iterator | unsafe_end () |
const_iterator | unsafe_begin () const |
const_iterator | unsafe_end () const |
Private Types | |
typedef tbb::internal::allocator_rebind< A, char >::type | page_allocator_type |
Allocator type. More... | |
Private Member Functions | |
virtual void * | allocate_block (size_t n) __TBB_override |
Allocates a block of size n (bytes) More... | |
virtual void | deallocate_block (void *b, size_t n) __TBB_override |
Deallocates block created by allocate_block. More... | |
Static Private Member Functions | |
static void | copy_construct_item (T *location, const void *src) |
static void | move_construct_item (T *location, const void *src) |
Private Attributes | |
page_allocator_type | my_allocator |
Friends | |
template<typename Container , typename Value > | |
class | internal::concurrent_queue_iterator |
Additional Inherited Members | |
![]() | |
typedef concurrent_queue_rep< T >::page | page |
![]() | |
concurrent_queue_base_v3 () | |
virtual | ~concurrent_queue_base_v3 () |
void | internal_push (const void *src, item_constructor_t construct_item) |
Enqueue item at tail of queue. More... | |
bool | internal_try_pop (void *dst) |
Attempt to dequeue item from queue. More... | |
size_t | internal_size () const |
Get size of queue; result may be invalid if queue is modified concurrently. More... | |
bool | internal_empty () const |
check if the queue is empty; thread safe More... | |
void | internal_finish_clear () |
free any remaining pages More... | |
void | internal_throw_exception () const |
Obsolete. More... | |
void | assign (const concurrent_queue_base_v3 &src, item_constructor_t construct_item) |
copy or move internal representation More... | |
void | internal_swap (concurrent_queue_base_v3 &src) |
swap internal representation More... | |
![]() | |
virtual | ~concurrent_queue_page_allocator () |
A high-performance thread-safe non-blocking concurrent queue.
Multiple threads may each push and pop concurrently. Assignment construction is not allowed.
Definition at line 35 of file concurrent_queue.h.
typedef A tbb::strict_ppl::concurrent_queue< T, A >::allocator_type |
Allocator type.
Definition at line 81 of file concurrent_queue.h.
typedef internal::concurrent_queue_iterator<concurrent_queue,const T> tbb::strict_ppl::concurrent_queue< T, A >::const_iterator |
Definition at line 169 of file concurrent_queue.h.
typedef const T& tbb::strict_ppl::concurrent_queue< T, A >::const_reference |
Const reference type.
Definition at line 72 of file concurrent_queue.h.
typedef ptrdiff_t tbb::strict_ppl::concurrent_queue< T, A >::difference_type |
Difference type for iterator.
Definition at line 78 of file concurrent_queue.h.
typedef internal::concurrent_queue_iterator<concurrent_queue,T> tbb::strict_ppl::concurrent_queue< T, A >::iterator |
Definition at line 168 of file concurrent_queue.h.
|
private |
Allocator type.
Definition at line 39 of file concurrent_queue.h.
typedef T& tbb::strict_ppl::concurrent_queue< T, A >::reference |
Reference type.
Definition at line 69 of file concurrent_queue.h.
typedef size_t tbb::strict_ppl::concurrent_queue< T, A >::size_type |
Integral type for representing size of the queue.
Definition at line 75 of file concurrent_queue.h.
typedef T tbb::strict_ppl::concurrent_queue< T, A >::value_type |
Element type in the queue.
Definition at line 66 of file concurrent_queue.h.
|
inlineexplicit |
Construct empty queue.
Definition at line 84 of file concurrent_queue.h.
|
inline |
[begin,end) constructor
Definition at line 91 of file concurrent_queue.h.
References begin, end, and tbb::strict_ppl::concurrent_queue< T, A >::push().
|
inline |
Copy constructor.
Definition at line 99 of file concurrent_queue.h.
References tbb::strict_ppl::internal::concurrent_queue_base_v3< T >::assign(), and tbb::strict_ppl::concurrent_queue< T, A >::copy_construct_item().
|
inline |
Move constructors.
Definition at line 107 of file concurrent_queue.h.
|
inline |
Definition at line 113 of file concurrent_queue.h.
References tbb::strict_ppl::internal::concurrent_queue_base_v3< T >::assign(), tbb::strict_ppl::concurrent_queue< T, A >::clear(), tbb::strict_ppl::internal::concurrent_queue_base_v3< T >::internal_swap(), tbb::strict_ppl::concurrent_queue< T, A >::move_construct_item(), and tbb::strict_ppl::concurrent_queue< T, A >::my_allocator.
tbb::strict_ppl::concurrent_queue< T, A >::~concurrent_queue | ( | ) |
Destroy queue.
Definition at line 190 of file concurrent_queue.h.
|
inlineprivatevirtual |
Allocates a block of size n (bytes)
Implements tbb::strict_ppl::internal::concurrent_queue_base_v3< T >.
Definition at line 43 of file concurrent_queue.h.
References tbb::internal::eid_bad_alloc, tbb::strict_ppl::concurrent_queue< T, A >::my_allocator, and tbb::internal::throw_exception().
void tbb::strict_ppl::concurrent_queue< T, A >::clear | ( | ) |
Clear the queue. not thread-safe.
Definition at line 196 of file concurrent_queue.h.
References value.
Referenced by tbb::strict_ppl::concurrent_queue< T, A >::concurrent_queue().
|
inlinestaticprivate |
Definition at line 55 of file concurrent_queue.h.
Referenced by tbb::strict_ppl::concurrent_queue< T, A >::concurrent_queue(), and tbb::strict_ppl::concurrent_queue< T, A >::push().
|
inlineprivatevirtual |
Deallocates block created by allocate_block.
Implements tbb::strict_ppl::internal::concurrent_queue_base_v3< T >.
Definition at line 51 of file concurrent_queue.h.
References tbb::strict_ppl::concurrent_queue< T, A >::my_allocator.
|
inline |
Definition at line 143 of file concurrent_queue.h.
References tbb::strict_ppl::concurrent_queue< T, A >::push().
|
inline |
Equivalent to size()==0.
Definition at line 160 of file concurrent_queue.h.
References tbb::strict_ppl::internal::concurrent_queue_base_v3< T >::internal_empty().
|
inline |
Return allocator object.
Definition at line 166 of file concurrent_queue.h.
References tbb::strict_ppl::concurrent_queue< T, A >::my_allocator.
|
inlinestaticprivate |
Definition at line 60 of file concurrent_queue.h.
References tbb::move().
Referenced by tbb::strict_ppl::concurrent_queue< T, A >::concurrent_queue(), and tbb::strict_ppl::concurrent_queue< T, A >::push().
|
inline |
Enqueue an item at tail of queue.
Definition at line 132 of file concurrent_queue.h.
References tbb::strict_ppl::concurrent_queue< T, A >::copy_construct_item(), and tbb::strict_ppl::internal::concurrent_queue_base_v3< T >::internal_push().
Referenced by tbb::strict_ppl::concurrent_queue< T, A >::concurrent_queue(), and tbb::strict_ppl::concurrent_queue< T, A >::emplace().
|
inline |
Definition at line 137 of file concurrent_queue.h.
References tbb::strict_ppl::internal::concurrent_queue_base_v3< T >::internal_push(), and tbb::strict_ppl::concurrent_queue< T, A >::move_construct_item().
|
inline |
Attempt to dequeue an item from head of queue.
Does not wait for item to become available. Returns true if successful; false otherwise.
Definition at line 152 of file concurrent_queue.h.
References tbb::strict_ppl::internal::concurrent_queue_base_v3< T >::internal_try_pop().
|
inline |
Definition at line 174 of file concurrent_queue.h.
|
inline |
Definition at line 176 of file concurrent_queue.h.
|
inline |
Definition at line 175 of file concurrent_queue.h.
|
inline |
Definition at line 177 of file concurrent_queue.h.
|
inline |
Return the number of items in the queue; thread unsafe.
Definition at line 157 of file concurrent_queue.h.
References tbb::strict_ppl::internal::concurrent_queue_base_v3< T >::internal_size().
|
friend |
Definition at line 36 of file concurrent_queue.h.
|
private |
Definition at line 40 of file concurrent_queue.h.
Referenced by tbb::strict_ppl::concurrent_queue< T, A >::allocate_block(), tbb::strict_ppl::concurrent_queue< T, A >::concurrent_queue(), tbb::strict_ppl::concurrent_queue< T, A >::deallocate_block(), and tbb::strict_ppl::concurrent_queue< T, A >::get_allocator().