OnixS C++ FIX Engine  4.10.1
API Documentation
ThreadSafeQueue Class Reference

#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 ()
 

Detailed Description

The thread-safe queue owns enqueued elements and deallocates element's memory on the destruction.

Definition at line 45 of file ThreadSafeQueue.h.

Constructor & Destructor Documentation

Initializes the instance.

Cleans up enqueued elements and internal resources.

Member Function Documentation

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').

Parameters
dequeueItemThe smart pointer to store the dequeued item.
waitInMsThe 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.

Exceptions
TheDomainException if the smart pointer is null.
Parameters
enqueueItemThe 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.


The documentation for this class was generated from the following file: