Threading::SafeQueue< TYPE > Class Template Reference
#include <safequeue.h>
Inheritance diagram for Threading::SafeQueue< TYPE >:
Detailed Description
template<class TYPE>
class Threading::SafeQueue< TYPE >
Thread-safe version of Util::Queue. The SafeQueue is normally configured to signal an internal Event object when an element is enqueued, so that a worker-thread can wait for new elements to arrive. This is the default behaviour. This doesn't make sense for a continously running thread (i.e. a rendering thread), thus this behaviour can be disabled using the SetSignalOnEnqueueEnabled(). In this case, the Enqueue() method won't signal the internal event, and the Wait() method will return immediately without ever waiting.(C) 2007 Radon Labs GmbH
Public Member Functions | |
SafeQueue () | |
constructor | |
SafeQueue (const SafeQueue< TYPE > &rhs) | |
copy constructor | |
void | operator= (const SafeQueue< TYPE > &rhs) |
assignment operator | |
void | SetSignalOnEnqueueEnabled (bool b) |
enable/disable signalling on Enqueue() (default is enabled) | |
bool | IsSignalOnEnqueueEnabled () const |
return signalling-on-Enqueue() flag | |
SizeT | Size () const |
returns number of elements in the queue | |
bool | IsEmpty () const |
return true if queue is empty | |
void | Clear () |
remove all elements from the queue | |
void | Enqueue (const TYPE &e) |
add element to the back of the queue | |
void | EnqueueArray (const Util::Array< TYPE > &a) |
enqueue an array of elements | |
TYPE | Dequeue () |
remove the element from the front of the queue | |
void | DequeueAll (Util::Array< TYPE > &outArray) |
dequeue all events (only requires one lock) | |
TYPE | Peek () const |
access to element at front of queue without removing it | |
void | Wait () |
wait until queue contains at least one element | |
void | WaitTimeout (int ms) |
wait until queue contains at least one element, or time-out happens | |
void | Signal () |
signal the internal event, so that Wait() will return | |
void | EraseMatchingElements (const TYPE &e) |
erase all matching elements | |
Protected Member Functions | |
TYPE & | operator[] (IndexT index) const |
access element by index, 0 is the frontmost element (next to be dequeued) | |
bool | operator== (const Queue< TYPE > &rhs) const |
equality operator | |
bool | operator!= (const Queue< TYPE > &rhs) const |
inequality operator | |
void | Reserve (SizeT num) |
increase capacity to fit N more elements into the queue | |
bool | Contains (const TYPE &e) const |
return true if queue contains element |
Member Function Documentation
template<class TYPE>
void Threading::SafeQueue< TYPE >::Signal | ( | ) |