#include <AsyncProducer.h>
Public Types | |
| typedef _CreationPolicy< ProductDescPolicy > | CreationPolicy |
| typedef ProductDescPolicy::Description | ProductDesc |
| typedef DestQueuePolicy< T >::Overflow | OverflowError |
Public Member Functions | |
| AsyncProducer () | |
| ~AsyncProducer () | |
| virtual void | startProduction () |
| virtual void | stopProduction (bool waitForDone=false) |
| bool | productionLoopOnce () |
| void | productionLoop () |
| virtual T | produce (typename boost::add_reference< ProductDesc >::type desc)=0 |
| virtual void | whileNotProducing () |
| virtual void | handleOverflow (OverflowError &err) |
Private Types | |
| typedef boost::mutex::scoped_lock | scoped_lock |
Private Attributes | |
| boost::shared_ptr< boost::thread > | _producerThread |
| boost::mutex | _exitProductionMutex |
| Atomic< bool > | _doExitProduction |
Static Private Attributes | |
| static const unsigned | _timeoutNanos = 10000 |
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||||||
|
|
|
|||||||||
|
|
|
||||||||||
|
handleOverflow Handles an overflow in the communication channels. It is highly recommended that you implement this method if your objects of type T do not fully conform to RAII, and you need to release a system handle, or deallocate some memory that would ordinarily be used by the consumer. Otherwise failure could result in resource leaks.
|
|
||||||||||
|
produce Override this to produce something of type T.
|
|
|||||||||
|
productionLoop Runs the production loop continously, until _doExit is true.
|
|
|||||||||
|
productionLoopOnce Goes through one production iteration, and returns true if it succeeded in producing AND sending a product.
|
|
|||||||||
|
startProduction Starts the producer thread. Always invoke this at the end of a subclasses override.
|
|
||||||||||
|
stopProduction Stops the producer thread, waiting until the thread is done if 'waitForDone' is true. Always invoke this at the end of a subclasses override.
|
|
|||||||||
|
whileNotProducing Override this if you want to do some work when the production is idle. |
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
|
|||||
|
|
1.4.4