Choose your operating system:
Windows
macOS
Linux
Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Containers/Queue.h |
Include |
#include "Containers/Queue.h" |
template<typename T, EQueueMode Mode>
class TQueue
Template for queues.
This template implements an unbounded non-intrusive queue using a lock-free linked list that stores copies of the queued items. The template can operate in two modes: Multiple-producers single-consumer (MPSC) and Single-producer single-consumer (SPSC).
The queue is thread-safe in both modes. The Dequeue() method ensures thread-safety by writing it in a way that does not depend on possible instruction reordering on the CPU. The Enqueue() method uses an atomic compare-and-swap in multiple-producers scenarios.
Name | Description | |
---|---|---|
|
TQueue() |
Default constructor. |
Name | Description | |
---|---|---|
|
~TQueue() |
Destructor. |
Name | Description | ||
---|---|---|---|
|
Dequeue ( |
Removes and returns the item from the tail of the queue. |
|
|
Empty() |
Empty the queue, discarding all items. @note To be called only from consumer thread. |
|
|
Enqueue ( |
Adds an item to the head of the queue. |
|
|
Enqueue ( |
Adds an item to the head of the queue. |
|
|
IsEmpty() |
Checks whether the queue is empty. |
|
|
FElementType... |
Peek() |
Peek at the queue's tail item without removing it. |
|
const FEleme... |
Peek() |
|
|
Peek ( |
Peeks at the queue's tail item without removing it. |
|
|
Pop() |
Removes the item from the tail of the queue. |
Name |
Description |
---|---|
FElementType |