From 5035f4ef68922ac758b1e4734e67d73c9228010b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 22 Aug 2019 14:38:57 +0200 Subject: Introduce notion of build context All non-const global state is now in class context and we can now have multiple independent builds going on at the same time. --- libbuild2/variable.cxx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'libbuild2/variable.cxx') diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx index c921bbd..86109d2 100644 --- a/libbuild2/variable.cxx +++ b/libbuild2/variable.cxx @@ -1243,7 +1243,7 @@ namespace build2 const bool* o, bool pat) { - assert (!global_ || phase == run_phase::load); + assert (!global_ || global_->phase == run_phase::load); // Apply pattern. // @@ -1318,7 +1318,7 @@ namespace build2 bool retro, bool match) { - assert (!global_ || phase == run_phase::load); + assert (!global_ || global_->phase == run_phase::load); size_t pn (p.size ()); @@ -1380,12 +1380,10 @@ namespace build2 } } - variable_pool variable_pool::instance (true); - const variable_pool& variable_pool::cinstance = variable_pool::instance; - const variable_pool& var_pool = variable_pool::cinstance; - // variable_map // + const variable_map empty_variable_map (nullptr /* context */); + auto variable_map:: find (const variable& var, bool typed) const -> pair @@ -1434,7 +1432,7 @@ namespace build2 pair, bool> variable_map:: insert (const variable& var, bool typed) { - assert (!global_ || phase == run_phase::load); + assert (!global_ || ctx->phase == run_phase::load); auto p (m_.emplace (var, value_data (typed ? var.type : nullptr))); value_data& r (p.first->second); -- cgit v1.1