From 88f0780e34116c0441a8d8c58b8a8fd9fde4b1f5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 25 Jan 2017 15:41:44 +0200 Subject: Add model mutex, make var_pool const by default --- build2/target.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'build2/target.cxx') diff --git a/build2/target.cxx b/build2/target.cxx index 64b376c..81d613f 100644 --- a/build2/target.cxx +++ b/build2/target.cxx @@ -613,8 +613,9 @@ namespace build2 out_base.normalize (); // In our world modifications to the scope structure during search & - // match should be "pure" in the sense that they should not affect any - // existing targets that have already been searched & matched. + // match should be "pure append" in the sense that they should not + // affect any existing targets that have already been searched & + // matched. // // A straightforward way to enforce this is to not allow any existing // targets to be inside any newly created scopes (except, perhaps for @@ -625,6 +626,10 @@ namespace build2 // not a subdirectory of out_base. So for now we just assume that this // is so. And so it is. + // Relock for exclusive access. + // + rlock rl (model_lock); + pair sp (switch_scope (*s.root_scope (), out_base)); if (sp.second != nullptr) // Ignore scopes out of any project. @@ -638,7 +643,7 @@ namespace build2 { l5 ([&]{trace << "loading buildfile " << bf << " for " << pk;}); - if (source_once (bf, root, base, root)) + if (source_once (root, base, bf, root)) { // If we loaded the buildfile, examine the target again. // -- cgit v1.1