diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-01-25 15:41:44 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-13 12:39:24 +0200 |
commit | 88f0780e34116c0441a8d8c58b8a8fd9fde4b1f5 (patch) | |
tree | 1240b36211772479dc1220712e0daed4e35ecd85 /build2/context | |
parent | 61aa8e2b4bd7849838c04dc1f421c4760d88319f (diff) |
Add model mutex, make var_pool const by default
Diffstat (limited to 'build2/context')
-rw-r--r-- | build2/context | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/build2/context b/build2/context index 1dd9daf..33b99a0 100644 --- a/build2/context +++ b/build2/context @@ -14,7 +14,32 @@ namespace build2 { - class file; + // Top-level internal state mutex. + // + extern shared_mutex model; + + // Thread's shared model lock. NULL in the serial stages. + // + extern +#ifdef __cpp_thread_local + thread_local +#else + __thread +#endif + slock* model_lock; + + // Cached variables. + // + extern const variable* var_src_root; + extern const variable* var_out_root; + extern const variable* var_src_base; + extern const variable* var_out_base; + + extern const variable* var_project; + extern const variable* var_amalgamation; + extern const variable* var_subprojects; + + extern const variable* var_import_target; // import.target // Current action (meta/operation). // @@ -75,14 +100,14 @@ namespace build2 // scopes, and variables. // variable_overrides - reset (const strings& cmd_vars); + reset (const ulock&, const strings& cmd_vars); // Return the project name or empty string if unnamed. // inline const string& - project (scope& root) + project (const scope& root) { - auto l (root["project"]); + auto l (root[var_project]); return l ? cast<string> (l) : empty_string; } |