Navigation
API > API/Runtime > API/Runtime/Chaos > API/Runtime/Chaos/Framework
References
| Module | Chaos |
| Header | /Engine/Source/Runtime/Experimental/Chaos/Public/Framework/TripleBufferedData.h |
| Include | #include "Framework/TripleBufferedData.h" |
Syntax
template<class DataType>
class TTripleBufferedData
Remarks
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
Constructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| DataType * | Get an updated buffer for the consuming thread to read from. | ||
| DataType * | Get a new buffer for the producing thread to write to, while at the same time making the previous buffer available to the consumer. |