qpid::sys::PollableQueue< T > Class Template Reference

A queue that can be polled by sys::Poller. More...

#include <PollableQueue.h>

Inheritance diagram for qpid::sys::PollableQueue< T >:

Inheritance graph
[legend]
Collaboration diagram for qpid::sys::PollableQueue< T >:

Collaboration graph
[legend]

List of all members.

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 ()


Detailed Description

template<class T>
class qpid::sys::PollableQueue< T >

A queue that can be polled by sys::Poller.

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.


Member Typedef Documentation

template<class T>
typedef boost::function<void (const T&)> qpid::sys::PollableQueue< T >::Callback

Callback to process a range of items.

Definition at line 47 of file PollableQueue.h.


Constructor & Destructor Documentation

template<class T>
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().


Member Function Documentation

template<class T>
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().

template<class T>
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().

template<class T>
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().


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

Generated on Thu Oct 16 13:38:40 2008 for Qpid by  doxygen 1.5.6