diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-10-22 10:02:23 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-10-22 10:17:41 +0200 |
commit | b47a323f09f1f9ccece03ca4d84dbe7a47ff8177 (patch) | |
tree | 7c520e5878b1988425520424c5e372f7439636d9 /libbuild2/variable.cxx | |
parent | 1bbd6bdb1bbf6783aefd10392e5c0599318a927f (diff) |
Move global mutex shards to context
Diffstat (limited to 'libbuild2/variable.cxx')
-rw-r--r-- | libbuild2/variable.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
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<value*> () (&v) % variable_cache_mutex_shard_size]); + ctx.mutex_shards.variable_cache[ + hash<value*> () (&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<shared_mutex[]> variable_cache_mutex_shard; - template struct LIBBUILD2_DEFEXPORT value_traits<strings>; template struct LIBBUILD2_DEFEXPORT value_traits<vector<name>>; template struct LIBBUILD2_DEFEXPORT value_traits<paths>; |