|
OpenWalnut
1.2.5
|
A worker thread that belongs to a. More...
#include <WWorkerThread.h>
Inheritance diagram for WWorkerThread< Function_T >:Public Types | |
| typedef boost::function< void() > | StopFunction |
| a type for stop callbacks | |
| typedef boost::function< void(WException const &) > | ExceptionFunction |
| a type for exception callbacks | |
Public Types inherited from WThreadedRunner | |
| typedef boost::function< void(void) > | THREADFUNCTION |
| Type used for simple thread functions. | |
Public Member Functions | |
| WWorkerThread (boost::shared_ptr< Function_T > func, std::size_t id, std::size_t numThreads) | |
| Default constructor. | |
| virtual | ~WWorkerThread () |
| Default destructor. | |
| void | subscribeExceptionSignal (ExceptionFunction func) |
| Subscribe a function to the exception signal. | |
| void | subscribeStopSignal (StopFunction func) |
| Subscribe a function to the stop signal. | |
Public Member Functions inherited from WThreadedRunner | |
| WThreadedRunner () | |
| Default constructor. | |
| virtual | ~WThreadedRunner () |
| Destructor. | |
| virtual void | run () |
| Run thread. | |
| void | run (THREADFUNCTION f) |
| Run thread. | |
| void | wait (bool requestFinish=false) |
| Wait for the thread to be finished. | |
| virtual void | requestStop () |
| This method's purpose is to request a stop without waiting for it. | |
Protected Member Functions | |
| virtual void | threadMain () |
| The thread's main function. | |
Protected Member Functions inherited from WThreadedRunner | |
| virtual void | notifyStop () |
| Gets called when the thread should be stopped. | |
| void | yield () const |
| Give remaining execution timeslice to another thread. | |
| void | sleep (const int32_t t) const |
| Sets thread asleep. | |
| void | msleep (const int32_t t) const |
| Sets thread asleep. | |
| void | waitForStop () |
| Let the thread sleep until a stop request was given. | |
Private Types | |
| typedef boost::signal< void() > | StopSignal |
| a type for stop signals | |
| typedef boost::signal< void(WException const &) > | ExceptionSignal |
| a type for exception signals | |
Private Member Functions | |
| WWorkerThread (WWorkerThread const &) | |
| WWorkerThread is non-copyable, so the copy constructor is not implemented. | |
| WWorkerThread & | operator= (WWorkerThread const &) |
| WWorkerThread is non-copyable, so the copy operator is not implemented. | |
Private Attributes | |
| boost::shared_ptr< Function_T > | m_func |
| the functor called in threadMain() | |
| std::size_t | m_id |
| a thread id between 0 and m_numThreads - 1 | |
| std::size_t | m_numThreads |
| the number of threads | |
| ExceptionSignal | m_exceptionSignal |
| the exception signal | |
| StopSignal | m_stopSignal |
| the stop signal | |
Additional Inherited Members | |
Protected Attributes inherited from WThreadedRunner | |
| boost::thread | m_thread |
| Thread instance. | |
| WBoolFlag | m_shutdownFlag |
| Condition getting fired whenever the thread should quit. | |
A worker thread that belongs to a.
Definition at line 42 of file WWorkerThread.h.
| typedef boost::function< void ( WException const& ) > WWorkerThread< Function_T >::ExceptionFunction |
a type for exception callbacks
Definition at line 57 of file WWorkerThread.h.
|
private |
a type for exception signals
Definition at line 49 of file WWorkerThread.h.
| typedef boost::function< void () > WWorkerThread< Function_T >::StopFunction |
a type for stop callbacks
Definition at line 54 of file WWorkerThread.h.
|
private |
a type for stop signals
Definition at line 46 of file WWorkerThread.h.
| WWorkerThread< Function_T >::WWorkerThread | ( | boost::shared_ptr< Function_T > | func, |
| std::size_t | id, | ||
| std::size_t | numThreads | ||
| ) |
Default constructor.
| func | A pointer to the function object. |
| id | A thread id. |
| numThreads | The number of threads. |
Definition at line 123 of file WWorkerThread.h.
References WWorkerThread< Function_T >::m_func.
|
virtual |
Default destructor.
Definition at line 141 of file WWorkerThread.h.
|
private |
WWorkerThread is non-copyable, so the copy constructor is not implemented.
|
private |
WWorkerThread is non-copyable, so the copy operator is not implemented.
| void WWorkerThread< Function_T >::subscribeExceptionSignal | ( | ExceptionFunction | func | ) |
Subscribe a function to the exception signal.
| func | The function. |
Definition at line 148 of file WWorkerThread.h.
Referenced by WWorkerThreadTest::testExceptions().
| void WWorkerThread< Function_T >::subscribeStopSignal | ( | StopFunction | func | ) |
Subscribe a function to the stop signal.
| func | The function. |
Definition at line 157 of file WWorkerThread.h.
Referenced by WWorkerThreadTest::testSingleThread(), and WWorkerThreadTest::testStopThread().
|
protectedvirtual |
The thread's main function.
Reimplemented from WThreadedRunner.
Definition at line 166 of file WWorkerThread.h.
|
private |
the exception signal
Definition at line 116 of file WWorkerThread.h.
|
private |
the functor called in threadMain()
Definition at line 107 of file WWorkerThread.h.
Referenced by WWorkerThread< Function_T >::WWorkerThread().
|
private |
a thread id between 0 and m_numThreads - 1
Definition at line 110 of file WWorkerThread.h.
|
private |
the number of threads
Definition at line 113 of file WWorkerThread.h.
|
private |
the stop signal
Definition at line 119 of file WWorkerThread.h.
1.8.1