This template provides inter-thread first-in first-out (FIFO) queueing. More...
#include <DwmPthreadQueue.hh>

Public Member Functions | |
| Queue () | |
| Constructor. | |
| ~Queue () | |
| Destructor. | |
| uint32_t | MaxLength () const |
| Returns the max length of the queue. More... | |
| uint32_t | MaxLength (uint32_t maxLength) |
| Sets and returns the max length of the queue. More... | |
| bool | PushBack (const _ValueType &value) |
Inserts value on the back of the queue. More... | |
| template<typename InputIterator > | |
| uint32_t | PushBack (InputIterator firstIter, InputIterator lastIter) |
| bool | PushFront (const _ValueType &value) |
Inserts value on the front of the queue. More... | |
| bool | ConditionSignal () |
| Unblocks at least one thread waiting on the condition variable. | |
| bool | ConditionWait () |
| Waits for the condition variable to be signalled or broadcasted. | |
| bool | ConditionTimedWait (const struct timespec &timeToWait) |
| Waits for the condition variable to be signalled or broadcasted for timeToWait to pass. More... | |
| bool | PopFront (_ValueType &value) |
Pops the entry from the front of the queue and stores it in value. More... | |
| bool | PopBack (_ValueType &value) |
Pops the entry from the back of the queue and stores it in value. More... | |
| bool | WaitForNotEmpty () |
| Blocks the calling thread until the queue contains at least one entry. More... | |
| bool | TimedWaitForNotEmpty (const struct timespec &timeToWait) |
Waits timeToWait for the queue to be non-empty. More... | |
| bool | Empty () |
| Returns true if the queue is empty, else returns false. | |
| void | RandomShuffle () |
| uint32_t | Copy (std::deque< _ValueType > &c) |
Protected Member Functions | |
| bool | Lock () |
| bool | Unlock () |
Protected Attributes | |
| uint32_t | _maxLength |
| std::deque< _ValueType > | _queue |
| Mutex | _mutex |
| ConditionVariable | _cv |
This template provides inter-thread first-in first-out (FIFO) queueing.
A source thread may insert objects into the back of the queue using PushBack() while a sink thread pops objects from the front of the queue using PopFront(). A sink thread may use WaitForNotEmpty() to wait for entries to be added to the queue; the calling thread will be blocked until the queue is non-empty. A sink thread may also choose to use ConditionWait() and PopFront(), which allows a source to wake up the sink using ConditionBroadcast() or ConditionSignal() without pushing an entry into the queue.
|
inline |
Waits for the condition variable to be signalled or broadcasted for timeToWait to pass.
Returns true if the condition variable was signalled or broadcasted, else returns false.

|
inline |
Returns the max length of the queue.
If 0, no maximum length will be enforced.
|
inline |
Sets and returns the max length of the queue.
If 0, no maximum length will be enforced.
|
inline |
Pops the entry from the back of the queue and stores it in value.
Returns true on success, false on failure.
|
inline |
Pops the entry from the front of the queue and stores it in value.
Returns true on success, false on failure.
|
inline |
Inserts value on the back of the queue.
Returns true on success, false on failure.

|
inline |
Inserts value on the front of the queue.
Returns true on success, false on failure.

|
inline |
Waits timeToWait for the queue to be non-empty.
Returns true if the queue is non-empty, else returns false.

|
inline |
Blocks the calling thread until the queue contains at least one entry.
Returns true on success, false on failure.
