From 2e6c3bf33ab1cd75b9936e65568a39571f279fc3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 9 Mar 2022 11:12:12 +0200 Subject: Parallel implementation of update_during_match_prerequisites() --- libbuild2/algorithm.ixx | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'libbuild2/algorithm.ixx') diff --git a/libbuild2/algorithm.ixx b/libbuild2/algorithm.ixx index bdf0815..29a4b59 100644 --- a/libbuild2/algorithm.ixx +++ b/libbuild2/algorithm.ixx @@ -688,6 +688,8 @@ namespace build2 inline target_state execute_wait (action a, const target& t) { + //@@ redo + if (execute (a, t) == target_state::busy) t.ctx.sched.wait (t.ctx.count_executed (), t[a].task_count, @@ -703,7 +705,43 @@ namespace build2 { target_state r (execute (a, t, sc, &tc)); - if (fail && !t.ctx.keep_going && r == target_state::failed) + if (r == target_state::failed && fail && !t.ctx.keep_going) + throw failed (); + + return r; + } + + LIBBUILD2_SYMEXPORT target_state + execute_direct (action, const target&, size_t, atomic_count*); + + inline target_state + execute_direct (action a, const target& t) + { + target_state r (execute_direct (a, t, 0, nullptr)); + + if (r == target_state::busy) + { + t.ctx.sched.wait (t.ctx.count_executed (), + t[a].task_count, + scheduler::work_none); + + r = t.executed_state (a, false); + } + + if (r == target_state::failed) + throw failed (); + + return r; + } + + inline target_state + execute_direct_async (action a, const target& t, + size_t sc, atomic_count& tc, + bool fail) + { + target_state r (execute_direct (a, t, sc, &tc)); + + if (r == target_state::failed && fail && !t.ctx.keep_going) throw failed (); return r; -- cgit v1.1