aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/context.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-02-10 11:52:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-02-10 11:52:34 +0200
commitdd25960e27d2f127e05d9f992eb577bc20e395ab (patch)
tree9a90b6f0a37081e3dbeacdbbf6439d5d5af5e71a /libbuild2/context.hxx
parentafe22af6ad346c653ed02109835e88348f4ecf5b (diff)
Make few global types separately constructible/initializable
Diffstat (limited to 'libbuild2/context.hxx')
-rw-r--r--libbuild2/context.hxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/libbuild2/context.hxx b/libbuild2/context.hxx
index c4d85c9..9df7a88 100644
--- a/libbuild2/context.hxx
+++ b/libbuild2/context.hxx
@@ -94,8 +94,18 @@ namespace build2
explicit
global_mutexes (size_t vc)
- : variable_cache_size (vc),
- variable_cache (new shared_mutex[variable_cache_size]) {}
+ {
+ init (vc);
+ }
+
+ global_mutexes () = default; // Create uninitialized instance.
+
+ void
+ init (size_t vc)
+ {
+ variable_cache_size = vc;
+ variable_cache.reset (new shared_mutex[vc]);
+ }
};
// A build context encapsulates the state of a build. It is possible to have