aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/algorithm.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-03-09 11:12:12 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-03-09 11:12:12 +0200
commit2e6c3bf33ab1cd75b9936e65568a39571f279fc3 (patch)
tree2c5a0b7554ffbfb47060f20fb1d3c412ac7edb1f /libbuild2/algorithm.ixx
parent2ede341d59b4ab259caf808dfa65c0ac380ba347 (diff)
Parallel implementation of update_during_match_prerequisites()
Diffstat (limited to 'libbuild2/algorithm.ixx')
-rw-r--r--libbuild2/algorithm.ixx40
1 files changed, 39 insertions, 1 deletions
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;