|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Member Functions | |
| ThreadSafeQueue () | |
| ~ThreadSafeQueue () | |
| void | queue (const T &data) |
| Add new item to end of queue. | |
| bool | dequeue (T &res) |
| Dequeue an item from the front of the queue. | |
| void | clear () |
| Remove all items from the queue. | |
| void | sort (int(*compareFunc)(const T *a, const T *b)) |
| Sort everything in the queue using the provided qsort-compatible function. | |
| Vector< T > & | lockVector () |
| Lock the vector for direct access. | |
| void | unlockVector () |
| Unlock the vector once we're done with it. | |
Private Attributes | |
| void * | mMutex |
| Vector< T > | mQueue |
| volatile bool | mLocked |
| ThreadSafeQueue< T >::ThreadSafeQueue | ( | ) | [inline] |
| ThreadSafeQueue< T >::~ThreadSafeQueue | ( | ) | [inline] |
| void ThreadSafeQueue< T >::queue | ( | const T & | data | ) | [inline] |
Add new item to end of queue.
| bool ThreadSafeQueue< T >::dequeue | ( | T & | res | ) | [inline] |
Dequeue an item from the front of the queue.
| void ThreadSafeQueue< T >::clear | ( | ) | [inline] |
Remove all items from the queue.
| void ThreadSafeQueue< T >::sort | ( | int(*)(const T *a, const T *b) | compareFunc | ) | [inline] |
Sort everything in the queue using the provided qsort-compatible function.
| Vector<T>& ThreadSafeQueue< T >::lockVector | ( | ) | [inline] |
Lock the vector for direct access.
| void ThreadSafeQueue< T >::unlockVector | ( | ) | [inline] |
Unlock the vector once we're done with it.
void* ThreadSafeQueue< T >::mMutex [private] |
Vector<T> ThreadSafeQueue< T >::mQueue [private] |
volatile bool ThreadSafeQueue< T >::mLocked [private] |