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/context.hxx | |
parent | 1bbd6bdb1bbf6783aefd10392e5c0599318a927f (diff) |
Move global mutex shards to context
Diffstat (limited to 'libbuild2/context.hxx')
-rw-r--r-- | libbuild2/context.hxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libbuild2/context.hxx b/libbuild2/context.hxx index d2e38e7..cc34803 100644 --- a/libbuild2/context.hxx +++ b/libbuild2/context.hxx @@ -99,6 +99,18 @@ namespace build2 mutex lm_; }; + class global_mutex_shards + { + public: + size_t variable_cache_size; + unique_ptr<shared_mutex[]> variable_cache; + + explicit + global_mutex_shards (size_t vc) + : variable_cache_size (vc), + variable_cache (new shared_mutex[variable_cache_size]) {} + }; + // @@ CTX: document (backlinks, non-overlap etc). RW story. // // A context can be preempted to execute another context (we do this, for @@ -122,6 +134,7 @@ namespace build2 public: scheduler& sched; + global_mutex_shards& mutex_shards; // Dry run flag (see --dry-run|-n). // @@ -412,6 +425,7 @@ namespace build2 // explicit context (scheduler&, + global_mutex_shards&, bool dry_run = false, bool keep_going = true, const strings& cmd_vars = {}, |