Mantid
|
ThreadPoolRunnable : Class used by thread pool (and POCO) to run inside a thread. More...
#include <ThreadPoolRunnable.h>
Public Member Functions | |
void | clearWait () |
Clear the wait time of the runnable so that it stops waiting for tasks. More... | |
void | run () override |
Thread method. More... | |
size_t | threadnum () |
Return the thread number of this thread. More... | |
ThreadPoolRunnable (size_t threadnum, ThreadScheduler *scheduler, ProgressBase *prog=nullptr, double waitSec=0.0) | |
Constructor. More... | |
Private Attributes | |
ProgressBase * | m_prog |
Progress reporter. More... | |
ThreadScheduler * | m_scheduler |
The ThreadScheduler instance taking care of task scheduling. More... | |
size_t | m_threadnum |
ID of this thread. More... | |
double | m_waitSec |
How many seconds you are allowed to wait with no tasks before exiting. More... | |
ThreadPoolRunnable : Class used by thread pool (and POCO) to run inside a thread.
Definition at line 24 of file ThreadPoolRunnable.h.
Mantid::Kernel::ThreadPoolRunnable::ThreadPoolRunnable | ( | size_t | threadnum, |
ThreadScheduler * | scheduler, | ||
ProgressBase * | prog = nullptr , |
||
double | waitSec = 0.0 |
||
) |
Constructor.
threadnum | :: the thread ID that this runnable is running in. |
scheduler | :: ThreadScheduler used by the thread pool |
prog | :: optional pointer to a Progress reporter object. If passed, then automatic progress reporting will be handled by the thread pool. |
waitSec | :: how many seconds the thread is allowed to wait with no tasks. |
Definition at line 27 of file ThreadPoolRunnable.cpp.
References m_scheduler.
void Mantid::Kernel::ThreadPoolRunnable::clearWait | ( | ) |
Clear the wait time of the runnable so that it stops waiting for tasks.
Definition at line 35 of file ThreadPoolRunnable.cpp.
References m_waitSec.
|
override |
Thread method.
Will wait for new tasks and run them as scheduled to it.
Definition at line 41 of file ThreadPoolRunnable.cpp.
References Mantid::Kernel::ThreadScheduler::abort(), Mantid::Kernel::ThreadScheduler::empty(), Mantid::Kernel::ThreadScheduler::finished(), m_prog, m_scheduler, m_threadnum, m_waitSec, Mantid::Kernel::ThreadScheduler::pop(), and Mantid::Kernel::ProgressBase::report().
|
inline |
Return the thread number of this thread.
Definition at line 29 of file ThreadPoolRunnable.h.
|
private |
|
private |
The ThreadScheduler instance taking care of task scheduling.
Definition at line 40 of file ThreadPoolRunnable.h.
Referenced by run(), and ThreadPoolRunnable().
|
private |
|
private |
How many seconds you are allowed to wait with no tasks before exiting.
Definition at line 46 of file ThreadPoolRunnable.h.
Referenced by clearWait(), and run().