pion-net
4.0.9
|
#include <PionLockedQueue.hpp>
Inherits noncopyable.
Classes | |
class | ConsumerThread |
data structure used to manage idle consumer threads waiting for items More... | |
struct | QueueNode |
data structure used to wrap each item in the queue More... | |
Public Member Functions | |
PionLockedQueue (void) | |
constructs a new PionLockedQueue | |
virtual | ~PionLockedQueue () |
virtual destructor | |
bool | empty (void) const |
returns true if the queue is empty; false if it is not | |
std::size_t | size (void) const |
returns the number of items that are currently in the queue | |
void | clear (void) |
clears the list by removing all remaining items | |
void | push (const T &t) |
bool | pop (T &t, ConsumerThread &thread_info) |
bool | pop (T &t) |
Protected Member Functions | |
QueueNode * | createNode (void) |
returns a new queue node item for use in the queue | |
void | destroyNode (QueueNode *node_ptr) |
frees memory for an existing queue node item | |
void | initialize (void) |
initializes head and tail pointers for empty queue | |
bool | dequeue (T &t, boost::uint32_t &version) |
PionLockedQueue: a thread-safe, two-lock concurrent FIFO queue
Definition at line 43 of file PionLockedQueue.hpp.
bool pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::dequeue | ( | T & | t, |
boost::uint32_t & | version | ||
) | [inline, protected] |
dequeues the next item from the top of the queue
t | assigned to the item at the top of the queue, if it is not empty |
boost::uint32_t | version number of the item retrieved, or head node if none |
Definition at line 91 of file PionLockedQueue.hpp.
References pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::destroyNode().
Referenced by pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::pop().
bool pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::pop | ( | T & | t, |
ConsumerThread & | thread_info | ||
) | [inline] |
pops the next item from the top of the queue. this may cause the calling thread to sleep until an item is available, and will only return when an item has been successfully retrieved or when the thread is stopping
t | assigned to the item at the top of the queue |
thread_info | ConsumerThread object used to manage the thread |
Definition at line 261 of file PionLockedQueue.hpp.
References pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::dequeue(), pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::ConsumerThread::getWakeupTimer(), pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::ConsumerThread::hasWakeupTimer(), and pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::ConsumerThread::isRunning().
bool pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::pop | ( | T & | t | ) | [inline] |
pops the next item from the top of the queue
t | assigned to the item at the top of the queue, if it is not empty |
Definition at line 296 of file PionLockedQueue.hpp.
References pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::dequeue().
void pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::push | ( | const T & | t | ) | [inline] |
pushes a new item into the back of the queue
t | the item to add to the back of the queue |
Definition at line 215 of file PionLockedQueue.hpp.
References pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::createNode(), and pion::PionLockedQueue< T, MaxSize, SleepMilliSec >::size().