Orocos Real-Time Toolkit 2.6.0
Create an atomic, non-blocking single ended queue (FIFO) for storing a pointer to T. More...
|typedef unsigned int||size_type|
|AtomicQueue (unsigned int size)|
|Create an AtomicQueue with queue size size. |
|bool||isFull () const|
|Inspect if the Queue is full. |
|bool||isEmpty () const|
|Inspect if the Queue is empty. |
|size_type||capacity () const|
|Return the maximum number of items this queue can contain. |
|size_type||size () const|
|Return the exact number of elements in the queue. |
|bool||enqueue (const T &value)|
|Enqueue an item. |
|bool||dequeue (T &result)|
|Dequeue an item. |
|const T||front () const|
|Return the next to be read value. |
|Clear all contents of the Queue and thus make it empty. |
Create an atomic, non-blocking single ended queue (FIFO) for storing a pointer to T.
It is a Many Readers, Many Writers implementation based on the atomic Compare And Swap instruction. Any number of threads may access the queue concurrently.
This queue tries to obey strict ordering, but under high contention of reads interfering writes, one or more elements may be dequeued out of order. For this reason, size() is expensive to accurately calculate the size.
Due to the same limitations, it is possible that the full capacity of the queue is not used (simulations show seldomly an off by one element if capacity==10) and that isFull() returns true, while size() < capacity().
|T||The pointer type to be stored in the Queue. Example : AtomicQueue< A* > is a queue of pointers to A.|