N_ProducerSingleConsumerQueue

Class Hierarchy
C++
template <typename T>
class N_ProducerSingleConsumerQueue : public CryMT::detail::N_ProducerSingleConsumerQueueBase;
File

CryThread.h

Description

Producer/Consumer Queue for N to 1 thread communication lockfree implemenation, to copy with multiple producers, a internal producer refcount is managed, the queue is empty as soon as there are no more producers and no new elements

N_ProducerSingleConsumerQueue::~N_ProducerSingleConsumerQueue Destructor
C++
N_ProducerSingleConsumerQueue::AddProducer Method
C++
void AddProducer();
Description

to correctly track when the queue is empty(and no new jobs will be added), refcount the producer

N_ProducerSingleConsumerQueue::Init Method
C++
void Init(size_t nSize);
N_ProducerSingleConsumerQueue::N_ProducerSingleConsumerQueue Constructor
C++
N_ProducerSingleConsumerQueue();
N_ProducerSingleConsumerQueue::Pop Method
C++
bool Pop(T * pResult);
N_ProducerSingleConsumerQueue::Push Method
C++
void Push(const T & rObj);
N_ProducerSingleConsumerQueue::RemoveProducer Method
C++
void RemoveProducer();
N_ProducerSingleConsumerQueue::SetRunningState Method
C++
void SetRunningState();
Description

needs to be called before using, assumes that there is at least one producer so the first one doesn't need to call AddProducer, but he has to deregister itself