Navigation
API > API/Runtime > API/Runtime/Chaos
A lock free paradigm for sharing data between threads.
Called a triple buffer because at any point in time, there may be 3 buffers available: 1 owned by the producing thread, 1 owned by the consuming thread, and 1 waiting in an atomic variable. The third storage location enables transfer of ownership such that if you have a copy of the data, you own it without worry of contention.
Producer thread: structAnimXf{TArray
Consumer thread: structMyConsumer{//Inthisexampletheconsumerownsthetriplebuffer,butthat's//notarequirement.TTripleBufferedData
| Name | TTripleBufferedData |
| Type | class |
| Header File | /Engine/Source/Runtime/Experimental/Chaos/Public/Framework/TripleBufferedData.h |
| Include Path | #include "Framework/TripleBufferedData.h" |
Syntax
template<class DataType>
class TTripleBufferedData
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Framework/TripleBufferedData.h | |||
TTripleBufferedData
(
TTripleBufferedData&& Other |
Non-copyable and non-movable, due to TAtomic member. | Framework/TripleBufferedData.h | |
TTripleBufferedData
(
const TTripleBufferedData& |
Framework/TripleBufferedData.h |
Structs
| Name | Remarks |
|---|---|
| DataTypeWrapper |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Buffers | DataTypeWrapper | Framework/TripleBufferedData.h | ||
| ConsumerThreadBuffer | DataTypeWrapper * | Framework/TripleBufferedData.h | ||
| Counter | uint64 | Framework/TripleBufferedData.h | ||
| Interchange | TAtomic< DataTypeWrapper * > | Framework/TripleBufferedData.h | ||
| LastId | uint64 | Framework/TripleBufferedData.h | ||
| ProducerThreadBuffer | DataTypeWrapper * | Framework/TripleBufferedData.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
DataType * ExchangeConsumerBuffer () |
Get an updated buffer for the consuming thread to read from. | Framework/TripleBufferedData.h | |
DataType * ExchangeProducerBuffer () |
Get a new buffer for the producing thread to write to, while at the same time making the previous buffer available to the consumer. | Framework/TripleBufferedData.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Framework/TripleBufferedData.h | |||
TTripleBufferedData & operator=
(
const TTripleBufferedData& |
Framework/TripleBufferedData.h |