diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-08 07:42:41 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-13 12:42:42 +0200 |
commit | 5cefca444f7062c61cc9d118ffea5901e05186fd (patch) | |
tree | 879d608f9a9084c7eaa4e5cb8bcad5650d966730 /build2/algorithm.ixx | |
parent | db2a696f810e41189bcdf5524696ff3d0cfbe5a9 (diff) |
Implement parallel operation execution
Diffstat (limited to 'build2/algorithm.ixx')
-rw-r--r-- | build2/algorithm.ixx | 37 |
1 files changed, 37 insertions, 0 deletions
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<const T*> (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); + } } |