diff options
author | saturneric <[email protected]> | 2024-01-05 13:28:59 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-01-05 13:28:59 +0000 |
commit | 57438e754cd857ef48c3960eefe2e957716acd80 (patch) | |
tree | 79d76b98d52b98110801a33f24b45ad7a60c7462 /src/core/module/GlobalModuleContext.cpp | |
parent | feat: integrate logging api to core (diff) | |
download | GpgFrontend-57438e754cd857ef48c3960eefe2e957716acd80.tar.gz GpgFrontend-57438e754cd857ef48c3960eefe2e957716acd80.zip |
fix: slove a multi-threads issue at task model
Diffstat (limited to 'src/core/module/GlobalModuleContext.cpp')
-rw-r--r-- | src/core/module/GlobalModuleContext.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/core/module/GlobalModuleContext.cpp b/src/core/module/GlobalModuleContext.cpp index 6222a97d..a86879ab 100644 --- a/src/core/module/GlobalModuleContext.cpp +++ b/src/core/module/GlobalModuleContext.cpp @@ -254,18 +254,18 @@ class GlobalModuleContext::Impl { // Check if the module is activated if (!module_info->activate) continue; - Thread::Task::TaskRunnable exec_runnerable = + Thread::Task::TaskRunnable const exec_runnerable = [module, event](DataObjectPtr) -> int { return module->Exec(event); }; - Thread::Task::TaskCallback exec_callback = [listener_module_id, event_id]( - int code, DataObjectPtr) { - if (code < 0) { - // Log an error if the module execution fails - GF_CORE_LOG_ERROR( - "module {} execution failed of event {}: exec return code {}", - listener_module_id, event_id, code); - } - }; + Thread::Task::TaskCallback const exec_callback = + [listener_module_id, event_id](int code, DataObjectPtr) { + if (code < 0) { + // Log an error if the module execution fails + GF_CORE_LOG_ERROR( + "module {} execution failed of event {}: exec return code {}", + listener_module_id, event_id, code); + } + }; Thread::TaskRunnerGetter::GetInstance() .GetTaskRunner(Thread::TaskRunnerGetter::kTaskRunnerType_Module) |