aboutsummaryrefslogtreecommitdiff
path: root/build2/scheduler.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-02-03 08:17:21 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-02-13 12:42:41 +0200
commit21c5af3dc018ec1f2218a3df3c8195cfcfe3aefa (patch)
treed0f0ac84592ff12144b7b52dea8ac2dbb2aaa04d /build2/scheduler.txx
parent0d3ce80a2f0cd8398225e7ef7a1abbe7e77a38fc (diff)
Add support for passing alternative task start counts to scheduler
Diffstat (limited to 'build2/scheduler.txx')
-rw-r--r--build2/scheduler.txx5
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.
}
}