You.i Engine
CYIConcurrentQueue< YI_DATA > Class Template Reference

Detailed Description

template<typename YI_DATA>
class CYIConcurrentQueue< YI_DATA >

A simple, thread safe queue.

The queue is templated so that any data type can be used with it.

#include <utility/YiConcurrentQueue.h>

Public Member Functions

 CYIConcurrentQueue ()
 
 CYIConcurrentQueue (const CYIConcurrentQueue< YI_DATA > &other)
 
CYIConcurrentQueueoperator= (const CYIConcurrentQueue< YI_DATA > &rhs)
 
void Push (const YI_DATA &rData)
 
void WaitEmpty ()
 
bool Empty () const
 
bool TryPop (YI_DATA &rValue)
 
bool WaitAndPop (YI_DATA &rValue)
 
void StopWaiting ()
 

Constructor & Destructor Documentation

◆ CYIConcurrentQueue() [1/2]

template<typename YI_DATA>
CYIConcurrentQueue< YI_DATA >::CYIConcurrentQueue ( )
inline

Default constructor.

◆ CYIConcurrentQueue() [2/2]

template<typename YI_DATA>
CYIConcurrentQueue< YI_DATA >::CYIConcurrentQueue ( const CYIConcurrentQueue< YI_DATA > &  other)
inline

Copy constructor.

Member Function Documentation

◆ Empty()

template<typename YI_DATA>
bool CYIConcurrentQueue< YI_DATA >::Empty ( ) const
inline

Checks if the queue is empty.

◆ operator=()

template<typename YI_DATA>
CYIConcurrentQueue& CYIConcurrentQueue< YI_DATA >::operator= ( const CYIConcurrentQueue< YI_DATA > &  rhs)
inline

Overloaded assignment operator.

◆ Push()

template<typename YI_DATA>
void CYIConcurrentQueue< YI_DATA >::Push ( const YI_DATA &  rData)
inline

Push a new piece of data into the queue.

◆ StopWaiting()

template<typename YI_DATA>
void CYIConcurrentQueue< YI_DATA >::StopWaiting ( )
inline

Wakes the queue, if it is waiting for a message to arrive.

See also
WaitAndPop()

◆ TryPop()

template<typename YI_DATA>
bool CYIConcurrentQueue< YI_DATA >::TryPop ( YI_DATA &  rValue)
inline

Attempt to remove an element from the queue, unless the queue is empty or a mutext lock cannot be obtained.

◆ WaitAndPop()

template<typename YI_DATA>
bool CYIConcurrentQueue< YI_DATA >::WaitAndPop ( YI_DATA &  rValue)
inline

Wait for the queue to become available, and then remove an element from the queue. If the waiting is interrupted via StopWaiting(), returns false with no valid rValue. User should check the return code before reading rValue.

◆ WaitEmpty()

template<typename YI_DATA>
void CYIConcurrentQueue< YI_DATA >::WaitEmpty ( )
inline

Returns when the queue is empty.


The documentation for this class was generated from the following file: