Sirikata
|
A queue of any type that has thread-safe push() and pop() functions. More...
#include <LockFreeQueue.hpp>
Classes | |
class | FreeNodePool |
struct | Node |
class | NodeIterator |
Public Member Functions | |
LockFreeQueue () | |
~LockFreeQueue () | |
void | push (const T &value) |
Pushes value onto the queue. | |
bool | pop (T &value) |
Pops the front value from the queue and places it in value. | |
void | blockingPop (T &item) |
void | swap (std::deque< T > &swapWith) |
void | popAll (std::deque< T > *toPop) |
bool | probablyEmpty () |
Private Member Functions | |
Node * | fork () |
Private Attributes | |
class Sirikata::LockFreeQueue::FreeNodePool | mFreeNodePool |
volatile Node * | mHead |
volatile Node * | mTail |
Friends | |
class | NodeIterator |
A queue of any type that has thread-safe push() and pop() functions.
Sirikata::LockFreeQueue< T >::LockFreeQueue | ( | ) | [inline] |
Sirikata::LockFreeQueue< T >::~LockFreeQueue | ( | ) | [inline] |
void Sirikata::LockFreeQueue< T >::blockingPop | ( | T & | item | ) | [inline] |
Node* Sirikata::LockFreeQueue< T >::fork | ( | ) | [inline, private] |
bool Sirikata::LockFreeQueue< T >::pop | ( | T & | value | ) | [inline] |
Pops the front value from the queue and places it in value.
value | Will have the T at the front of the queue copied into it. |
References Sirikata::compare_and_swap(), Sirikata::LockFreeQueue< T >::mFreeNodePool, Sirikata::LockFreeQueue< T >::mHead, Sirikata::LockFreeQueue< T >::Node::mNext, Sirikata::LockFreeQueue< T >::mTail, and Sirikata::LockFreeQueue< T >::FreeNodePool::release().
Referenced by Sirikata::LockFreeQueue< T >::popAll().
void Sirikata::LockFreeQueue< T >::popAll | ( | std::deque< T > * | toPop | ) | [inline] |
References Sirikata::LockFreeQueue< T >::pop().
Referenced by Sirikata::LockFreeQueue< T >::swap().
bool Sirikata::LockFreeQueue< T >::probablyEmpty | ( | ) | [inline] |
void Sirikata::LockFreeQueue< T >::push | ( | const T & | value | ) | [inline] |
Pushes value onto the queue.
value | Will be copied and placed onto the end of the queue. |
References Sirikata::LockFreeQueue< T >::FreeNodePool::allocate(), Sirikata::compare_and_swap(), Sirikata::LockFreeQueue< T >::Node::mContent, Sirikata::LockFreeQueue< T >::mFreeNodePool, Sirikata::LockFreeQueue< T >::Node::mNext, and Sirikata::LockFreeQueue< T >::mTail.
void Sirikata::LockFreeQueue< T >::swap | ( | std::deque< T > & | swapWith | ) | [inline] |
References Sirikata::LockFreeQueue< T >::popAll().
friend class NodeIterator [friend] |
class Sirikata::LockFreeQueue::FreeNodePool Sirikata::LockFreeQueue< T >::mFreeNodePool [private] |
volatile Node* Sirikata::LockFreeQueue< T >::mHead [private] |
volatile Node* Sirikata::LockFreeQueue< T >::mTail [private] |