aboutsummaryrefslogtreecommitdiff
path: root/build2/b.cxx
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/b.cxx
parent61aa8e2b4bd7849838c04dc1f421c4760d88319f (diff)
Add model mutex, make var_pool const by default
Diffstat (limited to 'build2/b.cxx')
-rw-r--r--build2/b.cxx30
1 files changed, 18 insertions, 12 deletions
diff --git a/build2/b.cxx b/build2/b.cxx
index b06459b..54defb3 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -96,6 +96,8 @@ main (int argc, char* argv[])
<< system_error (errno, system_category ()); // Sanitize.
#endif
+ ulock ml (model);
+
// Parse the command line. We want to be able to specify options, vars,
// and buildspecs in any order (it is really handy to just add -v at the
// end of the command line).
@@ -362,7 +364,7 @@ main (int argc, char* argv[])
//
if (dirty)
{
- var_ovs = reset (cmd_vars);
+ var_ovs = reset (ml, cmd_vars);
dirty = false;
}
@@ -572,7 +574,7 @@ main (int argc, char* argv[])
// See if the bootstrap process set/changed src_root.
//
- value& v (rs.assign ("src_root"));
+ value& v (rs.assign (var_src_root));
if (v)
{
@@ -650,7 +652,7 @@ main (int argc, char* argv[])
// Note that the subprojects variable has already been processed
// and converted to a map by the bootstrap_src() call above.
//
- if (auto l = rs.vars["subprojects"])
+ if (auto l = rs.vars[var_subprojects])
{
for (const auto& p: cast<subprojects> (l))
{
@@ -874,7 +876,7 @@ main (int argc, char* argv[])
trace << " out_root: " << out_root;
trace << " src_root: " << src_root;
- if (auto l = rs.vars["amalgamation"])
+ if (auto l = rs.vars[var_amalgamation])
trace << " amalgamat: " << cast<dir_path> (l);
}
@@ -973,7 +975,7 @@ main (int argc, char* argv[])
// Load the buildfile.
//
- mif->load (ts.buildfile, rs, ts.out_base, ts.src_base, l);
+ mif->load (ml, rs, ts.buildfile, ts.out_base, ts.src_base, l);
// Next search and match the targets. We don't want to start
// building before we know how to for all the targets in this
@@ -1007,7 +1009,11 @@ main (int argc, char* argv[])
? out_src (d, rs)
: dir_path ());
- mif->search (rs, target_key {ti, &d, &out, &tn.value, e}, l, tgs);
+ mif->search (ml,
+ rs,
+ target_key {ti, &d, &out, &tn.value, e},
+ l,
+ tgs);
}
} // target
@@ -1026,8 +1032,8 @@ main (int argc, char* argv[])
action a (mid, pre_oid, oid);
- mif->match (a, tgs);
- mif->execute (a, tgs, true); // Run quiet.
+ mif->match (ml, a, tgs);
+ mif->execute (ml, a, tgs, true); // Run quiet.
if (mif->operation_post != nullptr)
mif->operation_post (pre_oid);
@@ -1041,8 +1047,8 @@ main (int argc, char* argv[])
action a (mid, oid, 0);
- if (mif->match != nullptr) mif->match (a, tgs);
- if (mif->execute != nullptr) mif->execute (a, tgs, verb == 0);
+ if (mif->match != nullptr) mif->match (ml, a, tgs);
+ if (mif->execute != nullptr) mif->execute (ml, a, tgs, verb == 0);
if (post_oid != 0)
{
@@ -1057,8 +1063,8 @@ main (int argc, char* argv[])
action a (mid, post_oid, oid);
- mif->match (a, tgs);
- mif->execute (a, tgs, true); // Run quiet.
+ mif->match (ml, a, tgs);
+ mif->execute (ml, a, tgs, true); // Run quiet.
if (mif->operation_post != nullptr)
mif->operation_post (post_oid);