change parallel to thread

This commit is contained in:
chatlanin 2023-03-21 14:25:47 +03:00
parent e8b7e99b45
commit d807c9d41c

View File

@ -18,27 +18,20 @@ namespace try_engine::app_event
void execute(std::any type, std::any value) void execute(std::any type, std::any value)
{ {
// for (const auto layer : l_stack) for (const auto layer : l_stack)
// { {
// std::thread th { std::thread th {
// [=]() { [&]() {
// layer->on_event(type, value); layer->on_event(type, value);
// } }
// }; };
// th.detach(); th.detach();
// } }
tbb::parallel_for(tbb::blocked_range<int>(0, l_stack.size()), [&](tbb::blocked_range<int> r) { // tbb::parallel_for(tbb::blocked_range<int>(0, l_stack.size()), [&](tbb::blocked_range<int> r) {
for (int i = r.begin(); i < r.end(); ++i) // for (int i = r.begin(); i < r.end(); ++i)
{ // l_stack[i]->on_event(type, value);
std::thread th { // });
[&]() {
l_stack[i]->on_event(type, value);
}
};
th.detach();
}
});
} }
void print_size(); void print_size();