Enqueued tasks never gets picked up.

Enqueued tasks never gets picked up.

I have the following pattern

parallel_for (blocked_range(0 , max),  [ ] (r) {

for (size_t i = r.begin(); i != r.end(); ++i) {

         ctx[i]  = make_unique<tbb::task_group_context>();

         waitTask[i] = (new (tbb::task::allocate_root(*ctx))



        auto& workerTask = *new (waitTask->allocate_child()) WorkerTask(name);


        waitTask[i]->wait_for_all();  // wait for children to complete.



I get a hang with all threads in receive_or_steal_task, but the "execute" of WorkerTask never being called.

Things work fine if I wait on all waitTasks   outside of the parallel_for in a different parallel_for.


A sequential for loop in place of parallel_for in the above example also works fine .


1 post / 0 new