![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <Queue.h>
Public Types | |
| using | FElementType = T |
Public Member Functions | |
| TQueue () | |
| ~TQueue () | |
| UE_NONCOPYABLE (TQueue) | |
| bool | Dequeue (FElementType &OutItem) |
| void | Empty () |
| bool | Enqueue (const FElementType &Item) |
| bool | Enqueue (FElementType &&Item) |
| bool | IsEmpty () const |
| bool | Peek (FElementType &OutItem) const |
| FElementType * | Peek () |
| UE_FORCEINLINE_HINT const FElementType * | Peek () const |
| bool | Pop () |
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 three modes: Multiple-producers single-consumer (MPSC), Single-producer single-consumer (SPSC), and Single-threaded.
The queue is thread-safe in both MPSC and SPSC 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.
The queue is not thread-safe in single-threaded mode, as the name suggests.
| T | The type of items stored in the queue. |
| Mode | The queue mode (single-producer, single-consumer by default). |
| using TQueue< T, Mode >::FElementType = T |
|
inline |
Default constructor.
|
inline |
Destructor.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Peek at the queue's tail item without removing it.
This version of Peek allows peeking at a queue of items that do not allow copying, such as TUniquePtr.
|
inline |
|
inline |
|
inline |
| TQueue< T, Mode >::UE_NONCOPYABLE | ( | TQueue< T, Mode > | ) |