Module |
|
Header |
/Engine/Source/Runtime/Experimental/ChaosSolvers/Public/Framework/TripleBufferedData.h |
Include |
#include "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.
This function will manufacture new instances of `DataType_, if it needs to. Thus, the returned pointer will never be null.
The `DataType_ value is returned by shared pointer to simplify ownership semantics, particularly with respect to cleanup. It is important to not mistake that for exclusive ownership of the memory, and retain the return value of this function too long. For instance: TTripleBufferedData
Instead, always reuse the same shared pointer, or dereference the returned shared pointer if you're not worried about copying the data. TTripleBufferedData