aboutsummaryrefslogtreecommitdiff
path: root/build2/algorithm.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-02-16 11:30:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-16 11:30:41 +0200
commit63d1d6f8f4bb6db482b21e728245ebf9eee6b55f (patch)
tree61f1b519a447fd2b96c877bfced4b9fc8363824e /build2/algorithm.ixx
parentef12b3bf80e2eec3fcfd36cceee02f357a992039 (diff)
Fix group link-up race
Diffstat (limited to 'build2/algorithm.ixx')
-rw-r--r--build2/algorithm.ixx38
1 files changed, 35 insertions, 3 deletions
diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx
index f0330f6..9b1df35 100644
--- a/build2/algorithm.ixx
+++ b/build2/algorithm.ixx
@@ -360,10 +360,10 @@ namespace build2
}
group_view
- resolve_group_members_impl (action, const target&, target_lock);
+ resolve_members_impl (action, const target&, target_lock);
inline group_view
- resolve_group_members (action a, const target& g)
+ resolve_members (action a, const target& g)
{
group_view r;
@@ -386,7 +386,7 @@ namespace build2
// we can do, then unlock and return.
//
if (r.members == nullptr && l.offset != target::offset_executed)
- r = resolve_group_members_impl (a, g, move (l));
+ r = resolve_members_impl (a, g, move (l));
break;
}
@@ -398,6 +398,38 @@ namespace build2
}
void
+ resolve_group_impl (action, const target&, target_lock);
+
+ inline const target*
+ resolve_group (action a, const target& t)
+ {
+ if (a.outer ())
+ a = a.inner_action ();
+
+ switch (phase)
+ {
+ case run_phase::match:
+ {
+ // Grab a target lock to make sure the group state is synchronized.
+ //
+ target_lock l (lock_impl (a, t, scheduler::work_none));
+
+ // If the group is alrealy known or there is nothing else we can do,
+ // then unlock and return.
+ //
+ if (t.group == nullptr && l.offset < target::offset_tried)
+ resolve_group_impl (a, t, move (l));
+
+ break;
+ }
+ case run_phase::execute: break;
+ case run_phase::load: assert (false);
+ }
+
+ return t.group;
+ }
+
+ void
match_prerequisites (action, target&, const scope*);
void