From 5cefca444f7062c61cc9d118ffea5901e05186fd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 8 Feb 2017 07:42:41 +0200 Subject: Implement parallel operation execution --- build2/algorithm.ixx | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'build2/algorithm.ixx') diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx index b8c33d4..9ff56f8 100644 --- a/build2/algorithm.ixx +++ b/build2/algorithm.ixx @@ -172,12 +172,41 @@ namespace build2 search_and_match_prerequisite_members (ml, a, t, &s); } + target_state + execute (action, const target&, size_t, atomic_count*); + + inline target_state + execute (action a, const target& t) + { + return execute (a, t, 0, nullptr); + } + + inline target_state + execute_async (action a, const target& t, size_t sc, atomic_count& tc) + { + return execute (a, t, sc, &tc); + } + inline target_state execute_delegate (const recipe& r, action a, const target& t) { return r (a, t); } + inline target_state + execute_prerequisites (action a, const target& t) + { + auto& p (t.prerequisite_targets); + return straight_execute_members (a, t, p.data (), p.size ()); + } + + inline target_state + reverse_execute_prerequisites (action a, const target& t) + { + auto& p (t.prerequisite_targets); + return reverse_execute_members (a, t, p.data (), p.size ()); + } + // If the first argument is NULL, then the result is treated as a boolean // value. // @@ -220,4 +249,12 @@ namespace build2 auto p (execute_prerequisites (tt, a, t, mt, pf)); return make_pair (static_cast (p.first), p.second); } + + inline target_state + execute_members (action a, const target& t, const target* ts[], size_t n) + { + return current_mode == execution_mode::first + ? straight_execute_members (a, t, ts, n) + : reverse_execute_members (a, t, ts, n); + } } -- cgit v1.1