Mantid
Loading...
Searching...
No Matches
FindFilesThreadPoolManager.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
11
12#include <QObject>
13#include <QRunnable>
14#include <QSharedPointer>
15#include <QString>
16#include <QThreadPool>
17#include <functional>
18#include <memory>
19#include <string>
20#include <vector>
21
22namespace MantidQt {
23namespace API {
24
28 Q_OBJECT
30
31public:
35 void setAllocator(ThreadAllocator allocator);
36
38 void createWorker(const QObject *parent, const FindFilesSearchParameters &parameters);
40 bool isSearchRunning() const;
42 void waitForDone();
44 static void destroyThreadPool();
45
46signals:
47 // Signal emitted to cancel any already running workers
49
50private slots:
51 // Handle when a search is finished
52 void searchFinished();
53
54private:
56 const std::unique_ptr<QThreadPool> &poolInstance() const;
58 void cancelWorker();
60 void connectWorker(const QObject *parent, const FindFilesWorker *worker);
61
66};
67
68} // namespace API
69} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition: DllOption.h:15
A small helper class to hold a handle to a static thread pool.
std::function< FindFilesWorker *(const FindFilesSearchParameters &)> ThreadAllocator
ThreadAllocator m_workerAllocator
Handle to the allocator function for creating new worker threads.
bool m_searchIsRunning
Flag set if a search is currently running.
A class to allow the asynchronous finding of files.
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
POD struct to hold details about the parameters of a file search.