Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Containers/CircularQueue.h |
Include |
#include "Containers/CircularQueue.h" |
template<typename ElementType>
class TCircularQueue
Implements a lock-free first-in first-out queue using a circular array.
This class is thread safe only in single-producer single-consumer scenarios.
The number of items that can be enqueued is one less than the queue's capacity, because one item will be used for detecting full and empty states.
There is some room for optimization via using fine grained memory fences, but the implications for all of our target platforms need further analysis, so we're using the simpler sequentially consistent model for now.
Name | Description | |
---|---|---|
|
TCircularQueue ( |
Constructor. |
Name | Description | ||
---|---|---|---|
|
Count() |
Gets the number of elements in the queue. |
|
|
Dequeue() |
Removes an item from the front of the queue. To be called only from consumer thread. |
|
|
Dequeue ( |
Removes an item from the front of the queue. To be called only from consumer thread. |
|
|
Empty() |
Empties the queue. To be called only from consumer thread. |
|
|
Enqueue ( |
Adds an item to the end of the queue. To be called only from producer thread. |
|
|
Enqueue ( |
Adds an item to the end of the queue. To be called only from producer thread. |
|
|
IsEmpty() |
Checks whether the queue is empty. |
|
|
IsFull() |
Checks whether the queue is full. |
|
|
const Elemen... |
Peek() |
Returns the oldest item in the queue without removing it. |
|
Peek ( |
Returns the oldest item in the queue without removing it. |