diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-03 08:17:21 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-13 12:42:41 +0200 |
commit | 21c5af3dc018ec1f2218a3df3c8195cfcfe3aefa (patch) | |
tree | d0f0ac84592ff12144b7b52dea8ac2dbb2aaa04d /build2/scheduler.txx | |
parent | 0d3ce80a2f0cd8398225e7ef7a1abbe7e77a38fc (diff) |
Add support for passing alternative task start counts to scheduler
Diffstat (limited to 'build2/scheduler.txx')
-rw-r--r-- | build2/scheduler.txx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/build2/scheduler.txx b/build2/scheduler.txx index 127ce48..965813f 100644 --- a/build2/scheduler.txx +++ b/build2/scheduler.txx @@ -8,7 +8,7 @@ namespace build2 { template <typename F, typename... A> void scheduler:: - async (atomic_count& task_count, F&& f, A&&... a) + async (size_t start_count, atomic_count& task_count, F&& f, A&&... a) { using task = task_type<F, A...>; @@ -40,6 +40,7 @@ namespace build2 // new (&td->data) task { &task_count, + start_count, decay_copy (forward<F> (f)), typename task::args_type (decay_copy (forward<A> (a))...)}; @@ -85,7 +86,7 @@ namespace build2 t.thunk (std::index_sequence_for<A...> ()); atomic_count& tc (*t.task_count); - if (--tc == 0) + if (--tc == t.start_count) s.resume (tc); // Resume a waiter, if any. } } |