From 1872fc90f6d7e97246cdee6ad0e5059e9442518a Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 27 Nov 2020 07:27:29 -0500 Subject: [PATCH] renamed to g_top_level_tasks removed is_super_task(), not needed --- src/core/conf.cpp | 13 ++++++++----- src/tasks/task.cpp | 26 ++++++-------------------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/src/core/conf.cpp b/src/core/conf.cpp index c48b1e5..28c1ae8 100644 --- a/src/core/conf.cpp +++ b/src/core/conf.cpp @@ -156,13 +156,16 @@ std::string get_string_for_task( // for super for (auto&& tn : task_names) { - if (is_super_task(tn)) + for (auto&& t : find_tasks(tn)) { - v = find_string_for_task("super", key); - if (v) - return *v; + if (t->is_super()) + { + v = find_string_for_task("super", key); + if (v) + return *v; - break; + break; + } } } diff --git a/src/tasks/task.cpp b/src/tasks/task.cpp index 79698d2..6e6846c 100644 --- a/src/tasks/task.cpp +++ b/src/tasks/task.cpp @@ -10,7 +10,7 @@ namespace mob class interrupted {}; -static std::vector> g_tasks; +static std::vector> g_top_level_tasks; static std::vector g_all_tasks; static std::atomic g_interrupt = false; static alias_map g_aliases; @@ -19,7 +19,7 @@ std::mutex task::interrupt_mutex_; void add_task(std::unique_ptr t) { - g_tasks.push_back(std::move(t)); + g_top_level_tasks.push_back(std::move(t)); } std::vector get_all_tasks() @@ -36,7 +36,7 @@ std::vector get_top_level_tasks() { std::vector v; - for (auto&& t : g_tasks) + for (auto&& t : g_top_level_tasks) v.push_back(t.get()); return v; @@ -156,7 +156,7 @@ void run_all_tasks() { try { - for (auto& t : g_tasks) + for (auto& t : g_top_level_tasks) { t->fetch(); @@ -164,7 +164,7 @@ void run_all_tasks() throw interrupted(); } - for (auto& t : g_tasks) + for (auto& t : g_top_level_tasks) { t->join(); @@ -187,20 +187,6 @@ void run_all_tasks() } } -bool is_super_task(const std::string& name) -{ - for (auto& t : g_all_tasks) - { - for (auto&& tn : t->names()) - { - if (tn == name) - return t->is_super(); - } - } - - return false; -} - void add_alias(std::string name, std::vector names) { auto itor = g_aliases.find(name); @@ -431,7 +417,7 @@ void task::interrupt_all() std::scoped_lock lock(interrupt_mutex_); g_interrupt = true; - for (auto&& t : g_tasks) + for (auto&& t : g_top_level_tasks) t->interrupt(); }