From b47a323f09f1f9ccece03ca4d84dbe7a47ff8177 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 22 Oct 2019 10:02:23 +0200 Subject: Move global mutex shards to context --- libbuild2/variable.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libbuild2/variable.cxx') diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx index 22ea69d..1fe9914 100644 --- a/libbuild2/variable.cxx +++ b/libbuild2/variable.cxx @@ -359,13 +359,16 @@ namespace build2 } void - typify_atomic (value& v, const value_type& t, const variable* var) + typify_atomic (context& ctx, + value& v, + const value_type& t, + const variable* var) { // Typification is kind of like caching so we reuse that mutex shard. // shared_mutex& m ( - variable_cache_mutex_shard[ - hash () (&v) % variable_cache_mutex_shard_size]); + ctx.mutex_shards.variable_cache[ + hash () (&v) % ctx.mutex_shards.variable_cache_size]); // Note: v.type is rechecked by typify() under lock. // @@ -1139,7 +1142,7 @@ namespace build2 const bool* o) const { // Check overridability (all overrides, if any, should already have - // been entered (see context.cxx:reset()). + // been entered; see context ctor for details). // if (var.overrides != nullptr && (o == nullptr || !*o)) fail << "variable " << var.name << " cannot be overridden"; @@ -1514,9 +1517,6 @@ namespace build2 return lookup (); } - size_t variable_cache_mutex_shard_size; - unique_ptr variable_cache_mutex_shard; - template struct LIBBUILD2_DEFEXPORT value_traits; template struct LIBBUILD2_DEFEXPORT value_traits>; template struct LIBBUILD2_DEFEXPORT value_traits; -- cgit v1.1