aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/thread/TaskRunnerGetter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/thread/TaskRunnerGetter.cpp')
-rw-r--r--src/core/thread/TaskRunnerGetter.cpp16
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