#include <PollableQueue.h>
Public Types | |
typedef boost::function< void(const T &)> | Callback |
Callback to process a range of items. | |
Public Member Functions | |
PollableQueue (const Callback &cb, const boost::shared_ptr< sys::Poller > &poller) | |
When the queue is selected by the poller, values are passed to callback cb. | |
void | push (const T &t) |
Push a value onto the queue. | |
void | start () |
Start polling. | |
void | stop () |
Stop polling and wait for the current callback, if any, to complete. | |
bool | isStopped () const |
Are we currently stopped? | |
size_t | size () |
bool | empty () |
Any thread can push to the queue, on wakeup the poller thread processes all items on the queue by passing them to a callback in a batch.
Definition at line 44 of file PollableQueue.h.
typedef boost::function<void (const T&)> qpid::sys::PollableQueue< T >::Callback |
qpid::sys::PollableQueue< T >::PollableQueue | ( | const Callback & | cb, | |
const boost::shared_ptr< sys::Poller > & | poller | |||
) | [inline] |
When the queue is selected by the poller, values are passed to callback cb.
Definition at line 85 of file PollableQueue.h.
References qpid::sys::DispatchHandle::startWatch(), and qpid::sys::DispatchHandle::unwatch().
void qpid::sys::PollableQueue< T >::push | ( | const T & | t | ) | [inline] |
Push a value onto the queue.
Thread safe
Definition at line 106 of file PollableQueue.h.
References qpid::sys::PollableCondition::set().
void qpid::sys::PollableQueue< T >::start | ( | ) | [inline] |
Start polling.
Definition at line 94 of file PollableQueue.h.
References qpid::sys::DispatchHandle::rewatch(), and qpid::sys::PollableCondition::set().
void qpid::sys::PollableQueue< T >::stop | ( | ) | [inline] |
Stop polling and wait for the current callback, if any, to complete.
Definition at line 130 of file PollableQueue.h.
References qpid::sys::DispatchHandle::unwatch(), and qpid::sys::Monitor::wait().