aboutsummaryrefslogtreecommitdiff
path: root/build2/algorithm.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-25 15:41:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-02-13 12:39:24 +0200
commit88f0780e34116c0441a8d8c58b8a8fd9fde4b1f5 (patch)
tree1240b36211772479dc1220712e0daed4e35ecd85 /build2/algorithm.ixx
parent61aa8e2b4bd7849838c04dc1f421c4760d88319f (diff)
Add model mutex, make var_pool const by default
Diffstat (limited to 'build2/algorithm.ixx')
-rw-r--r--build2/algorithm.ixx49
1 files changed, 28 insertions, 21 deletions
diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx
index 90a0789..7da189d 100644
--- a/build2/algorithm.ixx
+++ b/build2/algorithm.ixx
@@ -51,14 +51,16 @@ namespace build2
}
pair<const rule*, match_result>
- match_impl (action, target&, bool apply, const rule* skip = nullptr);
+ match_impl (slock&, action, target&, bool apply, const rule* skip = nullptr);
inline void
- match (action a, target& t)
+ match (slock& ml, action a, target& t)
{
if (!t.recipe (a))
- match_impl (a, t, true);
+ match_impl (ml, a, t, true);
+ //@@ MT
+ //
t.dependents++;
dependency_count++;
@@ -70,74 +72,79 @@ namespace build2
{
// text << "U " << t << ": " << t.dependents << " " << dependency_count;
+ //@@ MT
+ //
assert (t.dependents != 0 && dependency_count != 0);
t.dependents--;
dependency_count--;
}
inline void
- match_only (action a, target& t)
+ match_only (slock& ml, action a, target& t)
{
if (!t.recipe (a))
- match_impl (a, t, false);
+ match_impl (ml, a, t, false);
}
inline pair<recipe, action>
- match_delegate (action a, target& t, const rule& r)
+ match_delegate (slock& ml, action a, target& t, const rule& r)
{
- auto rp (match_impl (a, t, false, &r));
+ auto rp (match_impl (ml, a, t, false, &r));
const match_result& mr (rp.second);
- return make_pair (rp.first->apply (mr.recipe_action, t), mr.recipe_action);
+ return make_pair (rp.first->apply (ml, mr.recipe_action, t),
+ mr.recipe_action);
}
group_view
- resolve_group_members_impl (action, target&);
+ resolve_group_members_impl (slock& ml, action, target&);
inline group_view
- resolve_group_members (action a, target& g)
+ resolve_group_members (slock& ml, action a, target& g)
{
group_view r (g.group_members (a));
- return r.members != nullptr ? r : resolve_group_members_impl (a, g);
+ return r.members != nullptr ? r : resolve_group_members_impl (ml, a, g);
}
void
- search_and_match_prerequisites (action, target&, scope*);
+ search_and_match_prerequisites (slock&, action, target&, scope*);
void
- search_and_match_prerequisite_members (action, target&, scope*);
+ search_and_match_prerequisite_members (slock&, action, target&, scope*);
inline void
- search_and_match_prerequisites (action a, target& t)
+ search_and_match_prerequisites (slock& ml, action a, target& t)
{
search_and_match_prerequisites (
+ ml,
a,
t,
(a.operation () != clean_id ? nullptr : &t.root_scope ()));
}
inline void
- search_and_match_prerequisite_members (action a, target& t)
+ search_and_match_prerequisite_members (slock& ml, action a, target& t)
{
if (a.operation () != clean_id)
- search_and_match_prerequisite_members (a, t, nullptr);
+ search_and_match_prerequisite_members (ml, a, t, nullptr);
else
// Note that here we don't iterate over members even for see-
// through groups since the group target should clean eveything
// up. A bit of an optimization.
//
- search_and_match_prerequisites (a, t, &t.root_scope ());
+ search_and_match_prerequisites (ml, a, t, &t.root_scope ());
}
inline void
- search_and_match_prerequisites (action a, target& t, scope& s)
+ search_and_match_prerequisites (slock& ml, action a, target& t, scope& s)
{
- search_and_match_prerequisites (a, t, &s);
+ search_and_match_prerequisites (ml, a, t, &s);
}
inline void
- search_and_match_prerequisite_members (action a, target& t, scope& s)
+ search_and_match_prerequisite_members (
+ slock& ml, action a, target& t, scope& s)
{
- search_and_match_prerequisite_members (a, t, &s);
+ search_and_match_prerequisite_members (ml, a, t, &s);
}
target_state