change parallel to thread
This commit is contained in:
parent
e8b7e99b45
commit
d807c9d41c
@ -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();
|
||||
// }
|
||||
|
||||
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 (const auto layer : l_stack)
|
||||
{
|
||||
std::thread th {
|
||||
[&]() {
|
||||
l_stack[i]->on_event(type, value);
|
||||
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);
|
||||
// });
|
||||
}
|
||||
|
||||
void print_size();
|
||||
|
Reference in New Issue
Block a user