diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-05-26 07:22:40 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-05-29 10:21:12 +0200 |
commit | ab91d32c1b23ea92b988d5618db2938a8c5dc63f (patch) | |
tree | fc02b89ae71aa3bcad127149718a7a4e7480f0b7 /libbuild2/target.hxx | |
parent | 56d79a62e64180f639dad02f0887fef5d57bb096 (diff) |
Avoid group linkup deadlocks for dynamic and pattern-static members
Diffstat (limited to 'libbuild2/target.hxx')
-rw-r--r-- | libbuild2/target.hxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx index 3f73e63..c7b1131 100644 --- a/libbuild2/target.hxx +++ b/libbuild2/target.hxx @@ -380,9 +380,12 @@ namespace build2 // // Note that the group-member link-up can happen anywhere between the // member creation and rule matching so reading the group before the - // member has been matched can be racy. + // member has been matched can be racy. However, once the member is linked + // up to the group, this relationship is immutable. As a result, one can + // atomically query the current value to see if already linked up (can be + // used as an optimization, to avoid deadlocks, etc). // - const target* group = nullptr; + relaxed_atomic<const target*> group = nullptr; // What has been described above is an "explicit" group. That is, there is // a dedicated target type that explicitly serves as a group and there is |