@@ -337,10 +337,11 @@ Task *task_submit_dep(Pool *pool, const Task *const *parent,
337337}
338338
339339static void pool_execute_task (Pool *pool, bool (*stopping_criterion)(void *),
340- void *payload) {
340+ void *payload, bool may_sleep ) {
341341 Task *task;
342342 uint32_t index;
343- std::tie (task, index) = pool->queue .pop_or_sleep (stopping_criterion, payload);
343+ std::tie (task, index) =
344+ pool->queue .pop_or_sleep (stopping_criterion, payload, may_sleep);
344345
345346 if (task) {
346347 if (task->func ) {
@@ -375,7 +376,7 @@ void pool_work_until(Pool *pool, bool (*stopping_criterion)(void *), void *paylo
375376 if (!pool)
376377 return ;
377378 while (!stopping_criterion (payload))
378- pool_execute_task (pool, stopping_criterion, payload);
379+ pool_execute_task (pool, stopping_criterion, payload, false );
379380}
380381
381382#if defined(__SSE2__)
@@ -415,7 +416,7 @@ void task_wait(Task *task) {
415416
416417 // Help executing work units in the meantime
417418 while (!stopping_criterion (task))
418- pool_execute_task (pool, stopping_criterion, task);
419+ pool_execute_task (pool, stopping_criterion, task, true );
419420
420421 task->wait_count --;
421422
@@ -496,7 +497,8 @@ void Worker::run() {
496497 FTZGuard ftz_guard (ftz);
497498 while (!stop)
498499 pool_execute_task (
499- pool, [](void *ptr) -> bool { return *((bool *) ptr); }, &stop);
500+ pool, [](void *ptr) -> bool { return *((bool *) ptr); }, &stop,
501+ true );
500502
501503 NT_TRACE (" worker stopped" );
502504
0 commit comments