engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 所有成员列表
Chaos::FGuardedTripleBuffer< ResourceType > 模板类 参考final

Triple buffer based on a single atomic variable, that guards against the consumer thread using old values. 更多...

#include <MultiBufferResource.h>

继承自 Chaos::IBufferResource< ResourceType > .

Public 成员函数

virtual ResourceType * AccessProducerBuffer () override
 Get the current producer buffer for writing. 更多...
 
 FGuardedTripleBuffer ()
 This class implements a circular buffer access pattern, such that during normal serial operation each buffer will be used. 更多...
 
virtual void FlipProducer ()
 Make the current producer buffer available to the consumer thread. 更多...
 
virtual const ResourceType * GetConsumerBuffer () const override
 Get an updated buffer for the consuming thread to read from. 更多...
 
virtual const ResourceType * GetProducerBuffer () const override
 Get the current producer buffer. 更多...
 
const ResourceType * PeekConsumerBuffer () const
 Get access to the currently held consumer buffer, ignoring whether it's already been consumed.
 

详细描述

template<typename ResourceType>
class Chaos::FGuardedTripleBuffer< ResourceType >

Triple buffer based on a single atomic variable, that guards against the consumer thread using old values.

Not thread-safe, requires external locks.

构造及析构函数说明

◆ FGuardedTripleBuffer()

template<typename ResourceType >
Chaos::FGuardedTripleBuffer< ResourceType >::FGuardedTripleBuffer ( )
inline

This class implements a circular buffer access pattern, such that during normal serial operation each buffer will be used.

However, we can alter how we use the API to use only 2 or 1 buffer:

SERIAL ACCESS BUFFER USE - NORMAL OPERATION: P C I Init: 0, 1, 2

AccP: *0, 1, 2 - *write access Flip: 2, 1, 0 Cons: 2, ^0, 1 - ^read access

AccP: *2, 0, 1 Flip: 1, 0, 2 Cons: 1, ^2, 0

AccP: *1, 2, 0 Flip: 0, 2, 1 Cons: 0, ^1, 2

SERIAL ACCESS BUFFER USE - DOUBLE BUFFER EMULATION: Init: 0, 1, 2

AccP: *0, 1, 2 - *write access Flip: 2, 1, 0 Cons: 2, ^0, 1 - ^read access Flip: 1, 0, 2 <- Add an extra flip and only use 2 buffers.

AccP: *1, 0, 2 Flip: 2, 0, 1 Cons: 2, ^1, 0 Flip: 0, 1, 2

SERIAL ACCESS BUFFER USE - SINGLE BUFFER EMULATION: Init: 0, 1, 2

AccP: *0, 1, 2 - *write access Flip: 2, 1, 0 Cons: 2, ^0, 1 - ^read access Cons: 2, 1, 0 <- Add an extra consume... Flip: 0, 1, 2 <- and an extra flip and only use 1 buffer.

成员函数说明

◆ AccessProducerBuffer()

template<typename ResourceType >
virtual ResourceType * Chaos::FGuardedTripleBuffer< ResourceType >::AccessProducerBuffer ( )
inlineoverridevirtual

Get the current producer buffer for writing.

The returned pointer will never be null.

This function should only be called by the producer thread.

◆ FlipProducer()

template<typename ResourceType >
virtual void Chaos::FGuardedTripleBuffer< ResourceType >::FlipProducer ( )
inlinevirtual

Make the current producer buffer available to the consumer thread.

This function should only be called by the producer thread.

◆ GetConsumerBuffer()

template<typename ResourceType >
virtual const ResourceType * Chaos::FGuardedTripleBuffer< ResourceType >::GetConsumerBuffer ( ) const
inlineoverridevirtual

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.

This function should only be called by the consumer thread.

◆ GetProducerBuffer()

template<typename ResourceType >
virtual const ResourceType * Chaos::FGuardedTripleBuffer< ResourceType >::GetProducerBuffer ( ) const
inlineoverridevirtual

Get the current producer buffer.

The returned pointer will never be null.

This function should only be called by the producer thread.


该类的文档由以下文件生成: