![]() |
OpenWalnut
1.5.0dev
|
A virtual base class for threaded functions (see below). More...
#include <WThreadedFunction.h>
Inheritance diagram for WThreadedFunctionBase:
Collaboration diagram for WThreadedFunctionBase:Public Types | |
| typedef boost::function< void(WException const &) > | ExceptionFunction |
| a type for exception callbacks More... | |
Public Member Functions | |
| WThreadedFunctionBase () | |
| Standard constructor. More... | |
| virtual | ~WThreadedFunctionBase () |
| Destroys the thread pool and stops all threads, if any one of them is still running. More... | |
| virtual void | run ()=0 |
| Starts the threads. More... | |
| virtual void | stop ()=0 |
| Request all threads to stop. More... | |
| virtual void | wait ()=0 |
| Wait for all threads to stop. More... | |
| WThreadedFunctionStatus | status () |
| Get the status of the threads. More... | |
| std::shared_ptr< WCondition > | getThreadsDoneCondition () |
| Returns a condition that gets fired when all threads have finished. More... | |
| void | subscribeExceptionSignal (ExceptionFunction func) |
| Subscribe a function to an exception signal. More... | |
Protected Member Functions | |
| WThreadedFunctionBase (WThreadedFunctionBase const &) | |
| WThreadedFunctionBase is non-copyable, so the copy constructor is not implemented. More... | |
| WThreadedFunctionBase & | operator= (WThreadedFunctionBase const &) |
| WThreadedFunctionBase is non-copyable, so the copy operator is not implemented. More... | |
Protected Attributes | |
| std::shared_ptr< WCondition > | m_doneCondition |
| a condition that gets notified when the work is complete More... | |
| ExceptionSignal | m_exceptionSignal |
| a signal for exceptions More... | |
| WSharedObject< WThreadedFunctionStatus > | m_status |
| the current status More... | |
Private Types | |
| typedef boost::signals2::signal< void(WException const &) > | ExceptionSignal |
| a type for exception signals More... | |
A virtual base class for threaded functions (see below).
Definition at line 65 of file WThreadedFunction.h.
| typedef boost::function< void ( WException const& ) > WThreadedFunctionBase::ExceptionFunction |
a type for exception callbacks
Definition at line 72 of file WThreadedFunction.h.
|
private |
a type for exception signals
Definition at line 68 of file WThreadedFunction.h.
| WThreadedFunctionBase::WThreadedFunctionBase | ( | ) |
Standard constructor.
Definition at line 29 of file WThreadedFunction.cpp.
References WSharedObject< T >::getWriteTicket(), and m_status.
Here is the call graph for this function:
|
virtual |
Destroys the thread pool and stops all threads, if any one of them is still running.
Definition at line 38 of file WThreadedFunction.cpp.
References m_exceptionSignal.
|
protected |
WThreadedFunctionBase is non-copyable, so the copy constructor is not implemented.
| std::shared_ptr< WCondition > WThreadedFunctionBase::getThreadsDoneCondition | ( | ) |
Returns a condition that gets fired when all threads have finished.
Definition at line 48 of file WThreadedFunction.cpp.
References m_doneCondition.
Referenced by WThreadedPerVoxelOperationTest::testMultithreadedFunction(), and WThreadedFunctionTest::testStopCondition().
Here is the caller graph for this function:
|
protected |
WThreadedFunctionBase is non-copyable, so the copy operator is not implemented.
|
pure virtual |
Starts the threads.
Implemented in WThreadedFunction< Function_T >.
| WThreadedFunctionStatus WThreadedFunctionBase::status | ( | ) |
Get the status of the threads.
Definition at line 43 of file WThreadedFunction.cpp.
References WSharedObject< T >::getReadTicket(), and m_status.
Referenced by WThreadedFunctionTest::testExceptionHandling(), WThreadedFunctionTest::testMultipleThreads(), WThreadedFunctionTest::testStopCondition(), and WThreadedFunctionTest::testStopThreads().
Here is the call graph for this function:
Here is the caller graph for this function:
|
pure virtual |
Request all threads to stop.
Returns immediately, so you might have to wait() for the threads to actually finish.
Implemented in WThreadedFunction< Function_T >.
| void WThreadedFunctionBase::subscribeExceptionSignal | ( | ExceptionFunction | func | ) |
Subscribe a function to an exception signal.
| func | The function to subscribe. |
Definition at line 53 of file WThreadedFunction.cpp.
References m_exceptionSignal.
Referenced by WThreadedFunctionTest::testExceptionHandling(), and WThreadedPerVoxelOperationTest::testMultithreadedFunction().
Here is the caller graph for this function:
|
pure virtual |
Wait for all threads to stop.
Implemented in WThreadedFunction< Function_T >.
|
protected |
a condition that gets notified when the work is complete
Definition at line 137 of file WThreadedFunction.h.
Referenced by getThreadsDoneCondition().
|
protected |
a signal for exceptions
Definition at line 140 of file WThreadedFunction.h.
Referenced by subscribeExceptionSignal(), and ~WThreadedFunctionBase().
|
protected |
the current status
Definition at line 143 of file WThreadedFunction.h.
Referenced by status(), and WThreadedFunctionBase().