A high-performance thread-safe blocking concurrent bounded queue. More...
#include <concurrent_queue.h>
Public Types | |
typedef concurrent_bounded_queue< T, A > ::iterator | iterator |
typedef concurrent_bounded_queue< T, A > ::const_iterator | const_iterator |
Public Types inherited from tbb::concurrent_bounded_queue< T, A > | |
typedef T | value_type |
Element type in the queue. | |
typedef A | allocator_type |
Allocator type. | |
typedef T & | reference |
Reference type. | |
typedef const T & | const_reference |
Const reference type. | |
typedef std::ptrdiff_t | size_type |
Integral type for representing size of the queue. More... | |
typedef std::ptrdiff_t | difference_type |
Difference type for iterator. | |
typedef internal::concurrent_queue_iterator < concurrent_bounded_queue, T > | iterator |
typedef internal::concurrent_queue_iterator < concurrent_bounded_queue, const T > | const_iterator |
Public Member Functions | |
concurrent_queue (const A &a=A()) | |
Construct empty queue. | |
concurrent_queue (const concurrent_queue &src, const A &a=A()) | |
Copy constructor. | |
template<typename InputIterator > | |
concurrent_queue (InputIterator b, InputIterator e, const A &a=A()) | |
[begin,end) constructor | |
bool | push_if_not_full (const T &source) |
Enqueue an item at tail of queue if queue is not already full. More... | |
bool | pop_if_present (T &destination) |
Attempt to dequeue an item from head of queue. More... | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
Public Member Functions inherited from tbb::concurrent_bounded_queue< T, A > | |
concurrent_bounded_queue (const allocator_type &a=allocator_type()) | |
Construct empty queue. | |
concurrent_bounded_queue (const concurrent_bounded_queue &src, const allocator_type &a=allocator_type()) | |
Copy constructor. | |
template<typename InputIterator > | |
concurrent_bounded_queue (InputIterator begin, InputIterator end, const allocator_type &a=allocator_type()) | |
[begin,end) constructor | |
~concurrent_bounded_queue () | |
Destroy queue. | |
void | push (const T &source) |
Enqueue an item at tail of queue. | |
void | pop (T &destination) |
Dequeue item from head of queue. More... | |
void | abort () |
Abort all pending queue operations. | |
bool | try_push (const T &source) |
Enqueue an item at tail of queue if queue is not already full. More... | |
bool | try_pop (T &destination) |
Attempt to dequeue an item from head of queue. More... | |
size_type | size () const |
Return number of pushes minus number of pops. More... | |
bool | empty () const |
Equivalent to size()<=0. | |
size_type | capacity () const |
Maximum number of allowed elements. | |
void | set_capacity (size_type new_capacity) |
Set the capacity. More... | |
allocator_type | get_allocator () const |
return allocator object | |
void | clear () |
clear the queue. not thread-safe. | |
iterator | unsafe_begin () |
iterator | unsafe_end () |
const_iterator | unsafe_begin () const |
const_iterator | unsafe_end () const |
Friends | |
template<typename Container , typename Value > | |
class | internal::concurrent_queue_iterator |
A high-performance thread-safe blocking concurrent bounded queue.
This is the pre-PPL TBB concurrent queue which support boundedness and blocking semantics. Note that method names agree with the PPL-style concurrent queue. Multiple threads may each push and pop concurrently. Assignment construction is not allowed.
|
inline |
Attempt to dequeue an item from head of queue.
Does not wait for item to become available. Returns true if successful; false otherwise.
References tbb::concurrent_bounded_queue< T, A >::try_pop().
|
inline |
Enqueue an item at tail of queue if queue is not already full.
Does not wait for queue to become not full. Returns true if item is pushed; false if queue was already full.
References tbb::concurrent_bounded_queue< T, A >::try_push().