fw4spl
|
Private implementation of fwThread::Worker using boost::asio. More...
Public Types | |
typedef ::boost::asio::io_service | IOServiceType |
typedef ::boost::asio::io_service::work | WorkType |
typedef std::shared_ptr< WorkType > | WorkPtrType |
typedef std::thread | ThreadType |
Public Types inherited from fwThread::Worker | |
typedef ::fwCore::HiResClock::HiResClockType | PeriodType |
typedef std::function< void() > | TaskType |
typedef ::boost::any | ExitReturnType |
typedef std::shared_future< ExitReturnType > | FutureType |
Public Member Functions | |
void | stop () |
Waits for the last task to be processed and stops the loop. | |
void | post (TaskType handler) |
Requests invocation of the given task handler and returns immediately. | |
ThreadIdType | getThreadId () const |
Returns the worker's thread id. | |
std::shared_ptr< ::fwThread::Timer > | createTimer () |
Creates and returns a fwThread::Timer running in this Worker. | |
virtual void | processTasks () |
Processes all worker pending tasks for the calling thread until there are no more tasks to process. You can call this function occasionally when your program is busy performing a long operation. More... | |
virtual void | processTasks (PeriodType maxtime) |
Processes worker pending tasks for the calling thread for maxtime milliseconds or until there are no more tasks to process. You can call this function occasionally when your program is busy performing a long operation. More... | |
Public Member Functions inherited from fwThread::Worker | |
virtual bool | isA (const std::string &type) const override |
template<typename R , typename CALLABLE > | |
std::shared_future< R > | postTask (CALLABLE f) |
Requests invocation of the given callable and returns a shared future. More... | |
virtual FutureType | getFuture () |
Returns a std::shared_future associated with the execution of Worker's loop. More... | |
template<typename R , typename TASK > | |
std::shared_future< R > | postTask (TASK f) |
virtual const std::string & | getLeafClassname () const override |
return object's classname without its namespace, i.e. BaseObject | |
virtual const std::string & | getClassname () const override |
return full object's classname with its namespace, i.e. fwCore::BaseObject | |
Public Member Functions inherited from fwCore::BaseObject |
Protected Member Functions | |
WorkerAsio (const WorkerAsio &) | |
Copy constructor forbidden. | |
WorkerAsio & | operator= (const WorkerAsio &) |
Copy operator forbidden. | |
Protected Member Functions inherited from fwThread::Worker | |
Worker (const Worker &) | |
Copy constructor forbidden. | |
Worker & | operator= (const Worker &) |
Copy operator forbidden. | |
Protected Attributes | |
IOServiceType | m_ioService |
Class provides functionality to manipulate asynchronous tasks. | |
WorkPtrType | m_work |
Class to inform the io_service when it has work to do. | |
std::shared_ptr< ThreadType > | m_thread |
Thread created and managed by the worker. | |
Protected Attributes inherited from fwThread::Worker | |
FutureType | m_future |
Worker's loop future. | |
Additional Inherited Members | |
Static Public Member Functions inherited from fwThread::Worker | |
static bool | isTypeOf (const std::string &type) |
static const std::string & | leafClassname () |
return object's classname without its namespace, i.e. BaseObject | |
static const std::string & | classname () |
return object's classname without its namespace, i.e. BaseObject | |
Static Public Member Functions inherited from fwCore::BaseObject | |
static bool | isTypeOf (const std::string &type) |
static const std::string & | leafClassname () |
return object's classname without its namespace, i.e. BaseObject | |
static const std::string & | classname () |
return object's classname without its namespace, i.e. BaseObject | |
Static Protected Member Functions inherited from fwThread::Worker | |
static FWTHREAD_API std::shared_ptr< Worker > | defaultFactory () |
Private implementation of fwThread::Worker using boost::asio.
Definition at line 31 of file WorkerAsio.cpp.
|
virtual |
Processes all worker pending tasks for the calling thread until there are no more tasks to process. You can call this function occasionally when your program is busy performing a long operation.
Implements fwThread::Worker.
Definition at line 197 of file WorkerAsio.cpp.
|
virtual |
Processes worker pending tasks for the calling thread for maxtime milliseconds or until there are no more tasks to process. You can call this function occasionally when your program is busy performing a long operation.
maxtime | milliseconds to process worker pending tasks. |
Implements fwThread::Worker.
Definition at line 204 of file WorkerAsio.cpp.
References fwCore::TimeStamp::modified(), fwCore::TimeStamp::periodExpired(), and fwCore::TimeStamp::setLifePeriod().