From d807c9d41c2200bb00196431f0c9cd59057c1923 Mon Sep 17 00:00:00 2001 From: chatlanin Date: Tue, 21 Mar 2023 14:25:47 +0300 Subject: [PATCH] change parallel to thread --- src/try_engine/event/app_event/event.hpp | 33 ++++++++++-------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/try_engine/event/app_event/event.hpp b/src/try_engine/event/app_event/event.hpp index 154fef0..de63065 100644 --- a/src/try_engine/event/app_event/event.hpp +++ b/src/try_engine/event/app_event/event.hpp @@ -18,27 +18,20 @@ namespace try_engine::app_event void execute(std::any type, std::any value) { - // for (const auto layer : l_stack) - // { - // std::thread th { - // [=]() { - // layer->on_event(type, value); - // } - // }; - // th.detach(); - // } + for (const auto layer : l_stack) + { + std::thread th { + [&]() { + layer->on_event(type, value); + } + }; + th.detach(); + } - tbb::parallel_for(tbb::blocked_range(0, l_stack.size()), [&](tbb::blocked_range r) { - for (int i = r.begin(); i < r.end(); ++i) - { - std::thread th { - [&]() { - l_stack[i]->on_event(type, value); - } - }; - th.detach(); - } - }); + // tbb::parallel_for(tbb::blocked_range(0, l_stack.size()), [&](tbb::blocked_range r) { + // for (int i = r.begin(); i < r.end(); ++i) + // l_stack[i]->on_event(type, value); + // }); } void print_size();