Navigation
API > API/Runtime > API/Runtime/Core
Fast, transactionally-safe multi-producer/single-consumer unbounded concurrent queue. Doesn't free memory until destruction but recycles consumed items.
The transactionally-safe queue uses a mutex to enforce thread safety instead of atomic operations. The difference in performance should be negligible unless you are CPU-bound on constantly enqueueing and dequeueing objects as fast as possible.
It is not safe to spin-wait on Dequeue from within an AutoRTFM transaction! The other thread's Enqueue will be blocked on the mutex, so you will deadlock inside the spin-wait.
| Name | TTransactionallySafeMpscQueue |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Containers/TransactionallySafeMpscQueue.h |
| Include Path | #include "Containers/TransactionallySafeMpscQueue.h" |
Syntax
template<typename T, typename AllocatorType>
class TTransactionallySafeMpscQueue
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Containers/TransactionallySafeMpscQueue.h | |||
| Containers/TransactionallySafeMpscQueue.h | |||
| Containers/TransactionallySafeMpscQueue.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~TTransactionallySafeMpscQueue() |
Containers/TransactionallySafeMpscQueue.h |
Structs
| Name | Remarks |
|---|---|
| FNode |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| ElementType | T | Containers/TransactionallySafeMpscQueue.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| First | FNode * | Containers/TransactionallySafeMpscQueue.h | ||
| Head | FNode * | Containers/TransactionallySafeMpscQueue.h | ||
| Mutex | UE::FTransactionallySafeMutex | This mutex guards all accesses to this structure or to FNode::Next. | Containers/TransactionallySafeMpscQueue.h | |
| Tail | FNode * | Containers/TransactionallySafeMpscQueue.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Returns NullOpt if the queue is empty. | Containers/TransactionallySafeMpscQueue.h | ||
bool Dequeue
(
ElementType& OutElem |
Containers/TransactionallySafeMpscQueue.h | ||
void Enqueue
(
ArgTypes&&... Args |
Containers/TransactionallySafeMpscQueue.h | ||
bool IsEmpty() |
Containers/TransactionallySafeMpscQueue.h | ||
ElementType * Peek () |
As there can be only one consumer, a consumer can safely "peek" the tail of the queue. | Containers/TransactionallySafeMpscQueue.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Containers/TransactionallySafeMpscQueue.h | |||
| Containers/TransactionallySafeMpscQueue.h |