TaskRunner.h
#ifndef GPGFRONTEND_TASKRUNNER_H
#define GPGFRONTEND_TASKRUNNER_H
#include <mutex>
#include <queue>
#include "core/GpgFrontendCore.h"
namespace GpgFrontend::Thread {
class Task;
class GPGFRONTEND_CORE_EXPORT TaskRunner : public QThread {
Q_OBJECT
public:
TaskRunner();
virtual ~TaskRunner() override;
void run() override;
public slots:
void PostTask(Task* task);
private:
std::queue<Task*> tasks;
std::map<std::string, Task*> pending_tasks_;
std::mutex tasks_mutex_;
};
} // namespace GpgFrontend::Thread
#endif // GPGFRONTEND_TASKRUNNER_H
GpgFrontend::Thread::TaskRunner
Definition: TaskRunner.h:39
GpgFrontend::Thread::TaskRunner::PostTask
void PostTask(Task *task)
Definition: TaskRunner.cpp:38
GpgFrontend::Thread
Definition: CtxCheckTask.h:33
GpgFrontend::Thread::TaskRunner::TaskRunner
TaskRunner()
Construct a new Task Runner object.
GpgFrontend::Thread::TaskRunner::tasks
std::queue< Task * > tasks
The task queue.
Definition: TaskRunner.h:70
GpgFrontend::Thread::TaskRunner::tasks_mutex_
std::mutex tasks_mutex_
The task queue mutex.
Definition: TaskRunner.h:72
GpgFrontend::Thread::TaskRunner::pending_tasks_
std::map< std::string, Task * > pending_tasks_
The pending tasks.
Definition: TaskRunner.h:71
GpgFrontend::Thread::Task
Definition: Task.h:45
GpgFrontend::Thread::Task::GetUUID
std::string GetUUID() const
Definition: Task.cpp:71
GpgFrontend::Thread::TaskRunner::~TaskRunner
virtual ~TaskRunner() override
Destroy the Task Runner object.