From cf1670f9a6541e42f22d58e2de5940e64cb6637e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 15 May 2020 06:50:05 +0200 Subject: Implement ad hoc recipe sharing and locking --- libbuild2/target.ixx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'libbuild2/target.ixx') diff --git a/libbuild2/target.ixx b/libbuild2/target.ixx index bb30c9c..36ca3c8 100644 --- a/libbuild2/target.ixx +++ b/libbuild2/target.ixx @@ -114,8 +114,6 @@ namespace build2 inline pair target:: matched_state_impl (action a) const { - assert (ctx.phase == run_phase::match); - // Note that the "tried" state is "final". // const opstate& s (state[a]); @@ -138,13 +136,14 @@ namespace build2 inline target_state target:: executed_state_impl (action a) const { - assert (ctx.phase == run_phase::execute); return (group_state (a) ? group->state : state)[a].state; } inline target_state target:: matched_state (action a, bool fail) const { + assert (ctx.phase == run_phase::match); + // Note that the target could be being asynchronously re-matched. // pair r (matched_state_impl (a)); @@ -158,6 +157,8 @@ namespace build2 inline pair target:: try_matched_state (action a, bool fail) const { + assert (ctx.phase == run_phase::match); + pair r (matched_state_impl (a)); if (fail && r.first && r.second == target_state::failed) @@ -169,6 +170,8 @@ namespace build2 inline target_state target:: executed_state (action a, bool fail) const { + assert (ctx.phase == run_phase::execute || ctx.phase == run_phase::load); + target_state r (executed_state_impl (a)); if (fail && r == target_state::failed) @@ -193,6 +196,8 @@ namespace build2 inline bool target:: unchanged (action a) const { + assert (ctx.phase == run_phase::match); + return matched_state_impl (a).second == target_state::unchanged; } -- cgit v1.1