aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/context.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/context.hxx')
-rw-r--r--libbuild2/context.hxx14
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 = {},