diff --git a/Eigen/src/ThreadPool/ForkJoin.h b/Eigen/src/ThreadPool/ForkJoin.h index 233d2837a..588636a6c 100644 --- a/Eigen/src/ThreadPool/ForkJoin.h +++ b/Eigen/src/ThreadPool/ForkJoin.h @@ -76,7 +76,7 @@ class ForkJoinScheduler { } // Synchronous variant of ParallelForAsync. - // WARNING: Making nested calls to `ParallelFor`, e.g., calling `ParallelFor` inside a task passed into another + // WARNING: Making nested calls to `ParallelFor`, e.g., calling `ParallelFor` inside a task passed into another // `ParallelFor` call, may lead to deadlocks due to how task stealing is implemented. template static void ParallelFor(Index start, Index end, Index granularity, DoFnType&& do_func, @@ -92,6 +92,7 @@ class ForkJoinScheduler { // Schedules `right_thunk`, runs `left_thunk`, and runs other tasks until `right_thunk` has finished. template static void ForkJoin(LeftType&& left_thunk, RightType&& right_thunk, ThreadPoolTempl* thread_pool) { + typedef typename ThreadPoolTempl::Task Task; std::atomic right_done(false); auto execute_right = [&right_thunk, &right_done]() { std::forward(right_thunk)(); @@ -99,7 +100,7 @@ class ForkJoinScheduler { }; thread_pool->Schedule(execute_right); std::forward(left_thunk)(); - ThreadPool::Task task; + Task task; while (!right_done.load(std::memory_order_acquire)) { thread_pool->MaybeGetTask(&task); if (task.f) task.f();