TTripleBufferedData::ExchangeConsumerBuffer

Get an updated buffer for the consuming thread to read from.

Windows
MacOS
Linux

References

Module

ChaosSolvers

Header

/Engine/Source/Runtime/Experimental/ChaosSolvers/Public/Framework/TripleBufferedData.h

Include

#include "Framework/TripleBufferedData.h"

Syntax

DataType * ExchangeConsumerBuffer()

Remarks

Get an updated buffer for the consuming thread to read from.

The returned pointer may be null if the producer thread hasn't done an update since the last time this function was called.

The same capacity for a race condition exists with this functions return value as with `ExchangeProducerBuffer()_. TTripleBufferedDataIntBuffer;...int*MyCopy=IntBuffer.ExchangeConsumerBuffer();intX=*MyCopy;//OkIntBuffer.ExchangeConsumerBuffer();//MemholdingXreturnedtoproducerthread.intY=*MyCopy;//Racecondition!

Always refresh the same variable. TTripleBufferedDataIntBuffer;...int*MyCopy=IntBuffer.ExchangeConsumerBuffer();intX=*MyCopy;//OkMyCopy=IntBuffer.ExchangeConsumerBuffer();//MemholdingXreturnedtoproducerthread.intY=*MyCopy;//Ok

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss