Nebula
Loading...
Searching...
No Matches
Threading::LockFreeQueue< TYPE > Class Template Reference

#include <lockfreequeue.h>

Classes

struct  Node
 

Public Member Functions

 LockFreeQueue ()
 constructor
 
 ~LockFreeQueue ()
 destructor
 
void Resize (const SizeT size)
 resizes the queue to hold N elements
 
void Enqueue (const TYPE &item)
 enqueue item
 
bool Dequeue (TYPE &item)
 dequeue item
 
SizeT Size ()
 get size
 
bool IsEmpty ()
 returns true if empty
 

Private Member Functions

NodeAlloc ()
 allocates a new node from the storage
 
void Dealloc (Node *node)
 deallocs a node and puts it back into storage
 
bool CompareAndSwap (Node **currentValue, Node *expectValue, Node *newValue)
 does a compare-and-swap
 

Private Attributes

Nodehead
 
Nodetail
 
volatile SizeT size
 
NodefreeHead
 
NodefreeTail
 
Util::FixedArray< Nodestorage
 
SizeT capacity
 

Constructor & Destructor Documentation

◆ LockFreeQueue()

template<class TYPE >
Threading::LockFreeQueue< TYPE >::LockFreeQueue ( )
inline

constructor

◆ ~LockFreeQueue()

template<class TYPE >
Threading::LockFreeQueue< TYPE >::~LockFreeQueue ( )
inline

destructor

Member Function Documentation

◆ Alloc()

template<class TYPE >
__forceinline LockFreeQueue< TYPE >::Node * Threading::LockFreeQueue< TYPE >::Alloc ( )
private

allocates a new node from the storage

◆ CompareAndSwap()

template<class TYPE >
bool Threading::LockFreeQueue< TYPE >::CompareAndSwap ( Node ** currentValue,
Node * expectValue,
Node * newValue )
inlineprivate

does a compare-and-swap

◆ Dealloc()

template<class TYPE >
__forceinline void Threading::LockFreeQueue< TYPE >::Dealloc ( Node * node)
private

deallocs a node and puts it back into storage

Add node to free list.

◆ Dequeue()

template<class TYPE >
bool Threading::LockFreeQueue< TYPE >::Dequeue ( TYPE & item)
inline

dequeue item

◆ Enqueue()

template<class TYPE >
void Threading::LockFreeQueue< TYPE >::Enqueue ( const TYPE & item)
inline

enqueue item

◆ IsEmpty()

template<class TYPE >
bool Threading::LockFreeQueue< TYPE >::IsEmpty ( )
inline

returns true if empty

◆ Resize()

template<class TYPE >
void Threading::LockFreeQueue< TYPE >::Resize ( const SizeT size)
inline

resizes the queue to hold N elements

◆ Size()

template<class TYPE >
SizeT Threading::LockFreeQueue< TYPE >::Size ( )
inline

get size

Member Data Documentation

◆ capacity

template<class TYPE >
SizeT Threading::LockFreeQueue< TYPE >::capacity
private

◆ freeHead

template<class TYPE >
Node* Threading::LockFreeQueue< TYPE >::freeHead
private

◆ freeTail

template<class TYPE >
Node* Threading::LockFreeQueue< TYPE >::freeTail
private

◆ head

template<class TYPE >
Node* Threading::LockFreeQueue< TYPE >::head
private

◆ size

template<class TYPE >
volatile SizeT Threading::LockFreeQueue< TYPE >::size
private

◆ storage

template<class TYPE >
Util::FixedArray<Node> Threading::LockFreeQueue< TYPE >::storage
private

◆ tail

template<class TYPE >
Node* Threading::LockFreeQueue< TYPE >::tail
private

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