diff options
author | saturneric <[email protected]> | 2023-10-27 13:21:03 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-10-27 13:21:03 +0000 |
commit | 41c12e92031284e357bab04fe6e08b45c6dd3ba8 (patch) | |
tree | e5750afe5feee6cca15aa9b3b0915012047e3aba /src/core/thread/TaskRunnerGetter.cpp | |
parent | feat: gather more gnupg info to rt (diff) | |
download | GpgFrontend-41c12e92031284e357bab04fe6e08b45c6dd3ba8.tar.gz GpgFrontend-41c12e92031284e357bab04fe6e08b45c6dd3ba8.zip |
feat: improve thread system and gathering gnupg options info to rt
Diffstat (limited to 'src/core/thread/TaskRunnerGetter.cpp')
-rw-r--r-- | src/core/thread/TaskRunnerGetter.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/core/thread/TaskRunnerGetter.cpp b/src/core/thread/TaskRunnerGetter.cpp index 70ac5226..ce7dbd32 100644 --- a/src/core/thread/TaskRunnerGetter.cpp +++ b/src/core/thread/TaskRunnerGetter.cpp @@ -28,21 +28,27 @@ #include "core/thread/TaskRunnerGetter.h" -GpgFrontend::Thread::TaskRunnerGetter::TaskRunnerGetter(int channel) +#include <memory> + +#include "thread/TaskRunner.h" + +namespace GpgFrontend::Thread { + +TaskRunnerGetter::TaskRunnerGetter(int channel) : SingletonFunctionObject<TaskRunnerGetter>(channel) {} -GpgFrontend::Thread::TaskRunner* -GpgFrontend::Thread::TaskRunnerGetter::GetTaskRunner( +TaskRunnerPtr GpgFrontend::Thread::TaskRunnerGetter::GetTaskRunner( TaskRunnerType runner_type) { while (true) { auto it = task_runners_.find(runner_type); if (it != task_runners_.end()) { return it->second; } else { - auto runner = new TaskRunner(); + auto runner = std::make_shared<TaskRunner>(); task_runners_[runner_type] = runner; runner->Start(); continue; } } -}
\ No newline at end of file +} +} // namespace GpgFrontend::Thread
\ No newline at end of file |