mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 12:46:00 +08:00
Clean up and fix the documentation of ForkJoin.h
This commit is contained in:
parent
dc1126e762
commit
bc67025ba7
@ -48,11 +48,11 @@ namespace Eigen {
|
||||
// Example usage #2 (asynchronous):
|
||||
// ```
|
||||
// ThreadPool thread_pool(num_threads);
|
||||
// Barrier barrier(num_completions);
|
||||
// Barrier barrier(num_tasks * num_async_calls);
|
||||
// auto done = [&](){barrier.Notify();};
|
||||
// for (int k=0; k<num_async_calls; ++k) {
|
||||
// thread_pool.Schedule([&](){
|
||||
// ForkJoinScheduler::ParallelFor(0, num_tasks, granularity, parallel_task, done, &thread_pool);
|
||||
// ForkJoinScheduler::ParallelForAsync(0, num_tasks, granularity, parallel_task, done, &thread_pool);
|
||||
// });
|
||||
// }
|
||||
// barrier.Wait();
|
||||
@ -73,7 +73,7 @@ class ForkJoinScheduler {
|
||||
ForkJoinScheduler::RunParallelForAsync(start, end, granularity, do_func, done, thread_pool);
|
||||
}
|
||||
|
||||
// Synchronous variant of Async::ParallelFor.
|
||||
// Synchronous variant of ParallelForAsync.
|
||||
template <typename DoFnType>
|
||||
static void ParallelFor(int start, int end, int granularity, DoFnType do_func, Eigen::ThreadPool* thread_pool) {
|
||||
if (start >= end) return;
|
||||
@ -87,8 +87,7 @@ class ForkJoinScheduler {
|
||||
}
|
||||
|
||||
private:
|
||||
// Schedules `right_thunk`, runs `left_thunk` and runs other tasks until
|
||||
// `right_thunk` has finished.
|
||||
// Schedules `right_thunk`, runs `left_thunk`, and runs other tasks until `right_thunk` has finished.
|
||||
template <typename LeftType, typename RightType>
|
||||
static void ForkJoin(LeftType&& left_thunk, RightType&& right_thunk, Eigen::ThreadPool* thread_pool) {
|
||||
std::atomic<bool> right_done(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user