From 21c5af3dc018ec1f2218a3df3c8195cfcfe3aefa Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 3 Feb 2017 08:17:21 +0200 Subject: Add support for passing alternative task start counts to scheduler --- build2/scheduler.txx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'build2/scheduler.txx') 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 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; @@ -40,6 +40,7 @@ namespace build2 // new (&td->data) task { &task_count, + start_count, decay_copy (forward (f)), typename task::args_type (decay_copy (forward (a))...)}; @@ -85,7 +86,7 @@ namespace build2 t.thunk (std::index_sequence_for ()); atomic_count& tc (*t.task_count); - if (--tc == 0) + if (--tc == t.start_count) s.resume (tc); // Resume a waiter, if any. } } -- cgit v1.1