aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-10-22 10:02:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-10-22 10:17:41 +0200
commitb47a323f09f1f9ccece03ca4d84dbe7a47ff8177 (patch)
tree7c520e5878b1988425520424c5e372f7439636d9 /libbuild2/variable.hxx
parent1bbd6bdb1bbf6783aefd10392e5c0599318a927f (diff)
Move global mutex shards to context
Diffstat (limited to 'libbuild2/variable.hxx')
-rw-r--r--libbuild2/variable.hxx29
1 files changed, 12 insertions, 17 deletions
diff --git a/libbuild2/variable.hxx b/libbuild2/variable.hxx
index 3cb3d7f..29b8200 100644
--- a/libbuild2/variable.hxx
+++ b/libbuild2/variable.hxx
@@ -187,8 +187,8 @@ namespace build2
// that, variables set by the C++ code are by default non-overridable.
//
// Initial processing including entering of global overrides happens in
- // reset() before any other variables. Project wide overrides are entered in
- // main(). Overriding happens in scope::find_override().
+ // context ctor before any other variables. Project wide overrides are
+ // entered in main(). Overriding happens in scope::find_override().
//
// NULL type and normal visibility are the defaults and can be overridden by
// "tighter" values.
@@ -254,7 +254,7 @@ namespace build2
inline ostream&
operator<< (ostream& os, const variable& v) {return os << v.name;}
- //
+ // A value (of a variable, function argument, etc).
//
class LIBBUILD2_SYMEXPORT value
{
@@ -460,7 +460,7 @@ namespace build2
void typify (value&, const value_type&, const variable*);
LIBBUILD2_SYMEXPORT void
- typify_atomic (value&, const value_type&, const variable*);
+ typify_atomic (context&, value&, const value_type&, const variable*);
// Remove value type from the value reversing it to names. This is similar
// to reverse() below except that it modifies the value itself.
@@ -1005,8 +1005,8 @@ namespace build2
extern template struct LIBBUILD2_DECEXPORT
value_traits<std::map<project_name, dir_path>>;
- // Project-wide (as opposed to global) variable overrides. Returned by
- // context.cxx:reset().
+ // Project-wide (as opposed to global) variable overrides (see context ctor
+ // for details).
//
struct variable_override
{
@@ -1438,7 +1438,7 @@ namespace build2
void
clear () {m_.clear ();}
- // Implementation details.
+ // Implementation details (only used for empty_variable_map).
//
public:
explicit
@@ -1468,15 +1468,11 @@ namespace build2
// the references remain valid).
//
// Note that since the cache can be modified on any lookup (including during
- // the execute phase), it is protected by its own mutex shard (allocated in
- // main()). This shard is also used for value typification (which is kind of
- // like caching) during concurrent execution phases.
+ // the execute phase), it is protected by its own mutex shard (see
+ // global_mutex_shards in context). This shard is also used for value
+ // typification (which is kind of like caching) during concurrent execution
+ // phases.
//
- LIBBUILD2_SYMEXPORT extern size_t variable_cache_mutex_shard_size;
-
- LIBBUILD2_SYMEXPORT extern unique_ptr<shared_mutex[]>
- variable_cache_mutex_shard;
-
template <typename K>
class variable_cache
{
@@ -1486,7 +1482,7 @@ namespace build2
// then typify the cached value.
//
pair<value&, ulock>
- insert (K, const lookup& stem, size_t version, const variable&);
+ insert (context&, K, const lookup& stem, size_t version, const variable&);
private:
struct entry_type
@@ -1565,7 +1561,6 @@ namespace build2
context& ctx;
map_type map_;
bool global_;
-
};
class LIBBUILD2_SYMEXPORT variable_type_map