Mantid
Loading...
Searching...
No Matches
ThreadPoolRunnable.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidKernel/DllConfig.h"
10#include <Poco/Runnable.h>
11
12namespace Mantid {
13namespace Kernel {
14// Forward declares
15class ProgressBase;
16class ThreadScheduler;
17
24class MANTID_KERNEL_DLL ThreadPoolRunnable : public Poco::Runnable {
25public:
26 ThreadPoolRunnable(size_t threadnum, ThreadScheduler *scheduler, ProgressBase *prog = nullptr, double waitSec = 0.0);
27
29 size_t threadnum() { return m_threadnum; }
30
31 void run() override;
32
33 void clearWait();
34
35private:
38
41
44
46 double m_waitSec;
47};
48
49} // namespace Kernel
50} // namespace Mantid
ThreadPoolRunnable : Class used by thread pool (and POCO) to run inside a thread.
double m_waitSec
How many seconds you are allowed to wait with no tasks before exiting.
size_t m_threadnum
ID of this thread.
ProgressBase * m_prog
Progress reporter.
ThreadScheduler * m_scheduler
The ThreadScheduler instance taking care of task scheduling.
size_t threadnum()
Return the thread number of this thread.
The ThreadScheduler object defines how tasks are allocated to threads and in what order.
Helper class which provides the Collimation Length for SANS instruments.