A blocking queue that uses wait/notify and an array to hold the elements. More...
#include <ArrayBlockingQueue.hpp>
Public Member Functions | |
ArrayBlockingQueue (unsigned int capacity) | |
Create an array blocking queue with the specified capacity. More... | |
T | dequeue () override |
Dequeue an object, waiting for an object to become available if the queue is empty. More... | |
bool | empty () const override |
Returns true if the queue is empty. More... | |
void | enqueue (T &&element) override |
Enqueue an object, waiting for space to be available if the queue is full. More... | |
bool | full () const override |
Returns true if the queue is full. More... | |
T | tryDequeue () override |
Try to dequeue an object. More... | |
T | tryDequeue (std::chrono::milliseconds waitTime) override |
Try to dequeue an object, waiting for the specified time if the queue is empty. More... | |
A blocking queue that uses wait/notify and an array to hold the elements.
This queue is concurrent but not lock free.
T | the element type (must be default constructable in addition being move constructable and assignable) |
|
inlineexplicit |
Create an array blocking queue with the specified capacity.
|
inlineoverridevirtual |
Dequeue an object, waiting for an object to become available if the queue is empty.
Implements BlockingQueue< T >.
|
inlineoverridevirtual |
Returns true if the queue is empty.
Given the concurrent nature of block queues, this operation is approximate.
Implements BlockingQueue< T >.
|
inlineoverridevirtual |
Enqueue an object, waiting for space to be available if the queue is full.
The supplied element is moved during enqueuing.
Implements BlockingQueue< T >.
|
inlineoverridevirtual |
Returns true if the queue is full.
Given the concurrent nature of block queues, this operation is approximate.
Implements BlockingQueue< T >.
|
inlineoverridevirtual |
Try to dequeue an object.
if no dequeue was made, a default constructed object is returned.
Implements BlockingQueue< T >.
|
inlineoverridevirtual |
Try to dequeue an object, waiting for the specified time if the queue is empty.
if no dequeue was made, a default constructed object is returned.
Implements BlockingQueue< T >.