#include <OnixS/FIXEngine/Threading/ThreadSafeQueue.h>
Public Member Functions | |
ThreadSafeQueue () | |
~ThreadSafeQueue () | |
void | enqueue (ItemBaseUniquePtr &enqueueItem) |
ThreadSafeQueueResult::Enum | dequeue (ItemBaseUniquePtr &dequeueItem, const int waitInMs=InfiniteTimeout) |
void | clear () |
bool | empty () const |
void | signal () |
The thread-safe queue owns enqueued elements and deallocates element's memory on the destruction.
Definition at line 45 of file ThreadSafeQueue.h.
ThreadSafeQueue | ( | ) |
Initializes the instance.
~ThreadSafeQueue | ( | ) |
Cleans up enqueued elements and internal resources.
void clear | ( | ) |
Removes all elements from the queue.
ThreadSafeQueueResult::Enum dequeue | ( | ItemBaseUniquePtr & | dequeueItem, |
const int | waitInMs = InfiniteTimeout |
||
) |
Tries to get an item from the queue during the timeout.
Gives the ownership of the item to the smart pointer. Returns the ThreadSafeQueueResult
value which reflects the result status ('Timeout', 'Data', 'Signaled').
dequeueItem | The smart pointer to store the dequeued item. |
waitInMs | The waiting timeout. |
bool empty | ( | ) | const |
Returns 'true' if the queue is empty, otherwise 'false'.
void enqueue | ( | ItemBaseUniquePtr & | enqueueItem | ) |
Adds an item to the queue.
Takes the ownership of the item from the smart pointer.
The | DomainException if the smart pointer is null. |
enqueueItem | The smart pointer to the allocated item to enqueue. |
void signal | ( | ) |
Wakes up the queue if it was in the waiting mode.
The dequeue
method will return the 'Signaled' status if it was in the waiting mode.