Quark
0.1
|
An asynchronous queue which can be accessed from multiple threads in a threadsafe way. More...
#include <AsyncQueue.h++>
Public Member Functions | |
AsyncQueue (uint capacity) | |
Constructs a new AsyncQueue with the given maximum capacity. More... | |
~AsyncQueue () | |
Destructor. More... | |
void | offer (T *item) |
Offers an item to the queue. More... | |
T * | take (int timeout=-1) |
Removes an item from the head of the queue. More... | |
void | clear () |
Clears the queue. More... | |
An asynchronous queue which can be accessed from multiple threads in a threadsafe way.
T | The type of object held by this queue. |
AsyncQueue | ( | uint | capacity | ) |
Constructs a new AsyncQueue with the given maximum capacity.
~AsyncQueue | ( | ) |
Destructor.
void clear | ( | ) |
Clears the queue.
void offer | ( | T * | item | ) |
Offers an item to the queue.
If the queue is currently at maximum capacity, the call blocks until there is room. The item is added at the end of the queue.
item | The item to enqueue. |
T* take | ( | int | timeout = -1 | ) |
Removes an item from the head of the queue.
If the queue is currently empty, the call blocks until an item is available or the timeout expires. The item is removed from the head of the queue.
timeout | The timeout, in milliseconds, or -1 to wait indefinitely. |