#include <AsyncConsumer.h>
Public Types | |
| typedef SourceQueuePolicy< T >::IQueueType | SourceQueue |
Public Member Functions | |
| AsyncConsumer () | |
| virtual | ~AsyncConsumer () |
| virtual void | startConsuming () |
| virtual void | stopConsuming (bool wait=false) |
| bool | isConsuming () const |
| bool | scheduleConsumption (typename boost::add_reference< T >::type t) |
| bool | setConsumptionWaitTime (unsigned secs, unsigned nanos) |
| boost::tuple< unsigned, unsigned > | consumptionWaitTime () const |
| bool | consumeLoopOnce () |
| void | consumeLoop () |
| virtual void | consume (typename boost::add_reference< T >::type msg, SourceQueue &)=0 |
| virtual void | whileNotConsuming () |
| virtual void | consumerDone () |
Private Types | |
| typedef boost::shared_ptr< boost::thread > | ThreadHandle |
| typedef boost::mutex::scoped_lock | scoped_lock |
Private Attributes | |
| boost::mutex | _exitConsumptionMutex |
| volatile bool | _exitConsumptionFlag |
| ThreadHandle | _consumerThread |
| unsigned | _consWaitSecs |
| unsigned | _consWaitNanos |
| unsigned | _consNewSecs |
| unsigned | _consNewNanos |
| Atomic< bool > | _consChangeWait |
|
|||||
|
Reimplemented in ark::AsyncNotifier< Notification, Observer_t, Observed_t >. |
|
|||||
|
Reimplemented in ark::AsyncNotifier< Notification, Observer_t, Observed_t >. |
|
|||||
|
|
|
|||||||||
|
|
|
|||||||||
|
|
|
||||||||||||||||
|
consume Override this function to handle the consumed message.
|
|
|||||||||
|
consumeLoop Runs the consumer loop continuously, until _exitConsumptionFlag is set to true.
|
|
|||||||||
|
consumeLoopOnce Runs the consumer loop once, checking for messages and dispatching them. Notice that this function will block until a message is dispatched or _exitFlag is changed.
|
|
|||||||||
|
consumerDone Override this to perform some tasks right before the consumer thread exits. |
|
|||||||||
|
consumptionWaitTime
|
|
|||||||||
|
isConsuming
|
|
||||||||||
|
scheduleConsumption Schedules a consumption target for the consumer thread to process in the future, and returns whether it was scheduled or not immediately.
|
|
||||||||||||||||
|
setConsumptionWaitTime Sets the amount of time that the consumer will wait, before doing idle work or checking the source queue for more data.
|
|
|||||||||
|
startConsuming Starts the consumer run loop, or cancels a pending exit. Always invoke this at the end of a subclasses override.
|
|
||||||||||
|
stopConsuming Stops a running consumer thread, blocking until the thread joins, if the 'wait' flag is set. Always invoke this at the end of a subclasses override.
|
|
|||||||||
|
whileNotConsuming Override this function to perform tasks while the consumer is waiting for messages. |
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
1.4.4