Honeycomb  0.1
Component-Model Framework
Classes | Public Types | Public Member Functions | List of all members
honey::lockfree::Queue< T > Class Template Reference

Lock-free FIFO queue. Uses auto-expanding freelist allocator so memory is only reclaimed upon destruction. More...

#include <Queue.h>

Inheritance diagram for honey::lockfree::Queue< T >:
Inheritance graph
[legend]
Collaboration diagram for honey::lockfree::Queue< T >:
Collaboration graph
[legend]

Public Types

typedef T value_type
 

Public Member Functions

 Queue (szt capacity=0)
 
 ~Queue ()
 
void reserve (szt capacity)
 Ensure that enough storage is allocated for a number of elements. More...
 
szt capacity () const
 The number of elements for which storage is allocated. More...
 
template<class T_ >
void push (T_ &&val)
 Add new element constructed with val onto the end of the queue. More...
 
bool pop (optional< T & > val=optnull)
 Remove oldest element from the queue and copy it into val. Returns true on success, false if there is no element to pop. More...
 
bool front (T &val)
 Get a copy of the next element that will be popped. Returns true on success, false if there is no element. More...
 
bool back (T &val)
 Get a copy of the last element. Returns true on success, false if there is no element. More...
 
void clear ()
 Remove all elements. More...
 
bool empty () const
 Check whether the queue does not contain any elements. More...
 
szt size () const
 The number of elements in the queue. More...
 

Detailed Description

template<class T>
class honey::lockfree::Queue< T >

Lock-free FIFO queue. Uses auto-expanding freelist allocator so memory is only reclaimed upon destruction.

Based on the paper: "Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms", Michael, Scott - 1996

Member Typedef Documentation

template<class T>
typedef T honey::lockfree::Queue< T >::value_type

Constructor & Destructor Documentation

template<class T>
honey::lockfree::Queue< T >::Queue ( szt  capacity = 0)
inline
template<class T>
honey::lockfree::Queue< T >::~Queue ( )
inline

Member Function Documentation

template<class T>
bool honey::lockfree::Queue< T >::back ( T &  val)
inline

Get a copy of the last element. Returns true on success, false if there is no element.

template<class T>
szt honey::lockfree::Queue< T >::capacity ( ) const
inline

The number of elements for which storage is allocated.

template<class T>
void honey::lockfree::Queue< T >::clear ( )
inline

Remove all elements.

template<class T>
bool honey::lockfree::Queue< T >::empty ( ) const
inline

Check whether the queue does not contain any elements.

template<class T>
bool honey::lockfree::Queue< T >::front ( T &  val)
inline

Get a copy of the next element that will be popped. Returns true on success, false if there is no element.

template<class T>
bool honey::lockfree::Queue< T >::pop ( optional< T & >  val = optnull)
inline

Remove oldest element from the queue and copy it into val. Returns true on success, false if there is no element to pop.

template<class T>
template<class T_ >
void honey::lockfree::Queue< T >::push ( T_ &&  val)
inline

Add new element constructed with val onto the end of the queue.

template<class T>
void honey::lockfree::Queue< T >::reserve ( szt  capacity)
inline

Ensure that enough storage is allocated for a number of elements.

template<class T>
szt honey::lockfree::Queue< T >::size ( ) const
inline

The number of elements in the queue.


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