GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
TaskRunnerGetter.h
1 
29 #pragma once
30 
31 #include <mutex>
32 
33 #include "core/GpgFrontendCore.h"
34 #include "core/function/basic/GpgFunctionObject.h"
35 #include "core/thread/TaskRunner.h"
36 
37 namespace GpgFrontend::Thread {
38 
39 using TaskRunnerPtr = std::shared_ptr<TaskRunner>;
40 
41 class GPGFRONTEND_CORE_EXPORT TaskRunnerGetter
42  : public GpgFrontend::SingletonFunctionObject<TaskRunnerGetter> {
43  public:
44  enum TaskRunnerType {
45  kTaskRunnerType_Default,
46  kTaskRunnerType_GPG,
47  kTaskRunnerType_IO,
48  kTaskRunnerType_Network,
49  kTaskRunnerType_Module,
50  kTaskRunnerType_External_Process,
51  };
52 
53  explicit TaskRunnerGetter(
55 
56  auto GetTaskRunner(TaskRunnerType runner_type = kTaskRunnerType_Default)
57  -> TaskRunnerPtr;
58 
59  void StopAllTeakRunner();
60 
61  private:
62  std::map<TaskRunnerType, TaskRunnerPtr> task_runners_;
63  std::mutex task_runners_map_lock_;
64 };
65 
66 } // namespace GpgFrontend::Thread
Definition: GpgFunctionObject.h:58
static auto GetDefaultChannel() -> int
Get the Default Channel object.
Definition: GpgFunctionObject.h:131
Definition: TaskRunnerGetter.h:42
Definition: ModuleManager.h:39