GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
TaskRunner.h
1 
27 #ifndef GPGFRONTEND_TASKRUNNER_H
28 #define GPGFRONTEND_TASKRUNNER_H
29 
30 #include <mutex>
31 #include <queue>
32 
33 #include "core/GpgFrontendCore.h"
34 
35 namespace GpgFrontend::Thread {
36 
37 class Task;
38 
39 class GPGFRONTEND_CORE_EXPORT TaskRunner : public QThread {
40  Q_OBJECT
41  public:
47 
52  virtual ~TaskRunner() override;
53 
58  void run() override;
59 
60  public slots:
61 
67  void PostTask(Task* task);
68 
69  private:
70  std::queue<Task*> tasks;
71  std::map<std::string, Task*> pending_tasks_;
72  std::mutex tasks_mutex_;
73 };
74 } // namespace GpgFrontend::Thread
75 
76 #endif // GPGFRONTEND_TASKRUNNER_H
Definition: TaskRunner.h:39
std::mutex tasks_mutex_
The task queue mutex.
Definition: TaskRunner.h:72
std::map< std::string, Task * > pending_tasks_
The pending tasks.
Definition: TaskRunner.h:71
std::queue< Task * > tasks
The task queue.
Definition: TaskRunner.h:70
virtual ~TaskRunner() override
Destroy the Task Runner object.
TaskRunner()
Construct a new Task Runner object.
Definition: Task.h:45
Definition: CtxCheckTask.h:33