aboutsummaryrefslogtreecommitdiff
path: root/build2/dist/operation.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/dist/operation.cxx
parent61aa8e2b4bd7849838c04dc1f421c4760d88319f (diff)
Add model mutex, make var_pool const by default
Diffstat (limited to 'build2/dist/operation.cxx')
-rw-r--r--build2/dist/operation.cxx23
1 files changed, 17 insertions, 6 deletions
diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx
index 1b96282..83a5b01 100644
--- a/build2/dist/operation.cxx
+++ b/build2/dist/operation.cxx
@@ -30,7 +30,7 @@ namespace build2
}
static void
- dist_match (action, action_targets&)
+ dist_match (ulock&, action, action_targets&)
{
// Don't match anything -- see execute ().
}
@@ -54,7 +54,7 @@ namespace build2
const string& ext);
static void
- dist_execute (action, const action_targets& ts, bool)
+ dist_execute (ulock& ml, action, const action_targets& ts, bool)
{
tracer trace ("dist_execute");
@@ -97,6 +97,10 @@ namespace build2
const string& dist_package (cast<string> (l));
const process_path& dist_cmd (cast<process_path> (rs->vars["dist.cmd"]));
+ // Relock for shared access. @@ BOGUS
+ //
+ ml.unlock ();
+
// Get the list of operations supported by this project. Skip
// default_id.
//
@@ -120,6 +124,9 @@ namespace build2
if (verb >= 6)
dump (a);
+ slock sl (*ml.mutex ());
+ model_lock = &sl; // @@ Guard?
+
for (void* v: ts)
{
target& t (*static_cast<target*> (v));
@@ -131,13 +138,17 @@ namespace build2
l5 ([&]{trace << diag_doing (a, t);});
- match (a, t);
+ match (sl, a, t);
}
+ model_lock = nullptr;
+
if (verb >= 6)
dump (a);
}
+ ml.lock ();
+
// Add buildfiles that are not normally loaded as part of the
// project, for example, the export stub. They will still be
// ignored on the next step if the user explicitly marked them
@@ -169,7 +180,7 @@ namespace build2
// The same for subprojects that have been loaded.
//
- if (auto l = rs->vars["subprojects"])
+ if (auto l = rs->vars[var_subprojects])
{
for (auto p: cast<subprojects> (l))
{
@@ -247,8 +258,8 @@ namespace build2
action a (perform_id, update_id);
- perform.match (a, files);
- perform.execute (a, files, true); // Run quiet.
+ perform.match (ml, a, files);
+ perform.execute (ml, a, files, true); // Run quiet.
if (perform.operation_post != nullptr)
perform.operation_post (update_id);