aboutsummaryrefslogtreecommitdiff
path: root/build2/scheduler
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-02-08 15:27:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-02-13 12:42:42 +0200
commit29e92840c5eb6e56e047d1b0d2b80db66e9eaae5 (patch)
tree525cd9d1d8e4c19cfdd418e2fde2b21b0a38ffe0 /build2/scheduler
parent8eed1ebf9ca2532fac255708a8dc418378c78b0a (diff)
Make scheduler::async() indicate whether the task executed synchronously
Diffstat (limited to 'build2/scheduler')
-rw-r--r--build2/scheduler9
1 files changed, 6 insertions, 3 deletions
diff --git a/build2/scheduler b/build2/scheduler
index 16cc217..7447021 100644
--- a/build2/scheduler
+++ b/build2/scheduler
@@ -67,17 +67,20 @@ namespace build2
// subtlety can become important when passing shared locks; you would
// only want it to be copied if the task is queued).
//
+ // Return true if the task was queued and false if it was executed
+ // synchronously.
+ //
// If the scheduler is shutdown, throw system_error(ECANCELED).
//
template <typename F, typename... A>
- void
+ bool
async (size_t start_count, atomic_count& task_count, F&&, A&&...);
template <typename F, typename... A>
- void
+ bool
async (atomic_count& task_count, F&& f, A&&... a)
{
- async (0, task_count, forward<F> (f), forward<A> (a)...);
+ return async (0, task_count, forward<F> (f), forward<A> (a)...);
}
// Wait until the task count reaches the start count. If the scheduler is