Equalizer  1.2.1
Public Member Functions
co::base::LFQueue< T > Class Template Reference

A thread-safe, lock-free queue with non-blocking access. More...

#include <lfQueue.h>

+ Inheritance diagram for co::base::LFQueue< T >:
+ Collaboration diagram for co::base::LFQueue< T >:

List of all members.

Public Member Functions

 LFQueue (const int32_t size)
 Construct a new queue.
 ~LFQueue ()
 Destruct this queue.
bool isEmpty () const
void clear ()
 Reset (empty) the queue.
void resize (const int32_t size)
 Resize and reset the queue.
bool pop (T &result)
 Retrieve and pop the front element from the queue.
bool getFront (T &result)
 Retrieve the front element from the queue.
bool push (const T &element)
 Push a new element to the back of the queue.
size_t getCapacity () const

Detailed Description

template<typename T>
class co::base::LFQueue< T >

A thread-safe, lock-free queue with non-blocking access.

Typically used for caches and non-blocking communication between two execution threads.

Current implementation constraints:

Definition at line 46 of file lfQueue.h.


Constructor & Destructor Documentation

template<typename T >
co::base::LFQueue< T >::LFQueue ( const int32_t  size) [inline]

Construct a new queue.

Version:
1.0

Definition at line 50 of file lfQueue.h.

template<typename T >
co::base::LFQueue< T >::~LFQueue ( ) [inline]

Destruct this queue.

Version:
1.0

Definition at line 54 of file lfQueue.h.


Member Function Documentation

template<typename T >
void co::base::LFQueue< T >::clear ( ) [inline]

Reset (empty) the queue.

Version:
1.0

Definition at line 60 of file lfQueue.h.

template<typename T >
size_t co::base::LFQueue< T >::getCapacity ( ) const [inline]
Returns:
the maximum number of elements held by the queue.
Version:
1.0

Definition at line 141 of file lfQueue.h.

template<typename T >
bool co::base::LFQueue< T >::getFront ( T &  result) [inline]

Retrieve the front element from the queue.

Parameters:
resultthe front value or unmodified
Returns:
true if an element was placed in result, false if the queue is empty.
Version:
1.0

Definition at line 108 of file lfQueue.h.

template<typename T >
bool co::base::LFQueue< T >::isEmpty ( ) const [inline]
Returns:
true if the queue is empty, false otherwise.
Version:
1.0

Definition at line 57 of file lfQueue.h.

Referenced by co::base::LFQueue< T >::resize().

+ Here is the caller graph for this function:

template<typename T >
bool co::base::LFQueue< T >::pop ( T &  result) [inline]

Retrieve and pop the front element from the queue.

Parameters:
resultthe front value or unmodified
Returns:
true if an element was placed in result, false if the queue is empty.
Version:
1.0

Definition at line 89 of file lfQueue.h.

template<typename T >
bool co::base::LFQueue< T >::push ( const T &  element) [inline]

Push a new element to the back of the queue.

Parameters:
elementthe element to add.
Returns:
true if the element was placed, false if the queue is full
Version:
1.0

Definition at line 125 of file lfQueue.h.

template<typename T >
void co::base::LFQueue< T >::resize ( const int32_t  size) [inline]

Resize and reset the queue.

This method is not thread-safe. The queue has to be empty.

Version:
1.0

Definition at line 73 of file lfQueue.h.

References co::base::LFQueue< T >::isEmpty().

+ Here is the call graph for this function:


The documentation for this class was generated from the following file:
Generated on Fri Jun 8 2012 15:44:34 for Equalizer 1.2.1 by  doxygen 1.8.0