Nebula
|
#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 | |
Node * | Alloc () |
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 | |
Node * | head |
Node * | tail |
volatile SizeT | size |
Node * | freeHead |
Node * | freeTail |
Util::FixedArray< Node > | storage |
SizeT | capacity |
|
inline |
constructor
|
inline |
destructor
|
private |
allocates a new node from the storage
|
inlineprivate |
does a compare-and-swap
|
private |
deallocs a node and puts it back into storage
Add node to free list.
|
inline |
dequeue item
|
inline |
enqueue item
|
inline |
returns true if empty
|
inline |
resizes the queue to hold N elements
|
inline |
get size
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |