return parallel

This commit is contained in:
chatlanin 2023-03-21 13:57:27 +03:00
parent 2ac50173a3
commit 5f9b2b682b

View File

@ -18,20 +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<int>(0, l_stack.size()), [&](tbb::blocked_range<int> r) {
// for (int i = r.begin(); i < r.end(); ++i)
// l_stack[i]->on_event(type, value);
// });
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)
l_stack[i]->on_event(type, value);
});
}
void print_size();