#include <MonitoredQueue.h>
Inheritance diagram for ZThread::MonitoredQueue::
Public Methods | |
MonitoredQueue () throw () | |
virtual | ~MonitoredQueue () throw () |
virtual void | add (T item) throw (Synchronization_Exception) |
virtual T | next () throw (Synchronization_Exception) |
virtual T | next (unsigned long timeout) throw (Synchronization_Exception) |
bool | empty () throw (Synchronization_Exception) |
virtual void | cancel () throw (Synchronization_Exception) |
virtual bool | isCanceled () throw (Synchronization_Exception) |
Protected Attributes | |
LOCK | _lock |
Serialize access. | |
Condition | _notEmpty |
Signaled on not empty. | |
Condition | _isEmpty |
Signaled on empty. | |
std::deque<T> | _queue |
Backing deque. | |
bool | _canceled |
Cancellation flag. |
|
Create a new Queue |
|
Destroy this Queue |
|
Insert a new item into the queue. One thread blocked by a next() request will be woken up. This implementation signals a condition variable used to block threads waiting for items to be added to the queue
Reimplemented from ZThread::Queue. |
|
Cancel this queue, no more additions will be accepted.
Reimplemented from ZThread::Queue. |
|
Block calling until the queue becomes empty. This implementation should always return true. This implementation waits on a condition variable that is broadcast to each time the queue removed its last element. This can be a periodic occurrence; you may have a faster consumer than producer, for example. In this case, the queue might be emptied several times before it is canceled.
Reimplemented from ZThread::Queue. |
|
Check the cancelation status of this Queue
Reimplemented from ZThread::Cancelable. |
|
Take an item from the queue, block if empty. Any threads blocked by an empty call are awoken if this call empties the queue. The queue will try to acquire the lock it owns for up to timeout milliseconds, it will throw a timeout only when that time has expired w/o obtaining a lock
Reimplemented from ZThread::Queue. |
|
Take an item from the queue, block calling thread if empty. Any threads blocked by an empty call are awoken if this call empties the queue
Reimplemented from ZThread::Queue. |