diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-06-13 13:30:13 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-06-13 15:39:47 +0200 |
commit | 14c6648c71b4b8a12ac0905ff23fcd4de7f0556f (patch) | |
tree | 265b9b616486e77ad69820d1fe5fc7feb088bb97 /src/buildtool/file_system/git_tree.hpp | |
parent | 1ad1906f2ac3f73ccf2283e4c1cc992557d91161 (diff) | |
download | justbuild-14c6648c71b4b8a12ac0905ff23fcd4de7f0556f.tar.gz |
multithreading: Add AtomicValue to atomically set/get value
... and use it to replace the commonly used pattern in
Expression, LinkedMap, and GitTreeEntry. Furthermore, remove
assignment operators for Expression and LinkedMap as those
are considered to be used in an immutable manner anyway.
Diffstat (limited to 'src/buildtool/file_system/git_tree.hpp')
-rw-r--r-- | src/buildtool/file_system/git_tree.hpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/buildtool/file_system/git_tree.hpp b/src/buildtool/file_system/git_tree.hpp index 8371d785..ff7dc828 100644 --- a/src/buildtool/file_system/git_tree.hpp +++ b/src/buildtool/file_system/git_tree.hpp @@ -8,7 +8,7 @@ #include "gsl-lite/gsl-lite.hpp" #include "src/buildtool/file_system/git_cas.hpp" #include "src/buildtool/file_system/object_type.hpp" -#include "src/utils/cpp/atomic.hpp" +#include "src/buildtool/multithreading/atomic_value.hpp" #include "src/utils/cpp/hex_string.hpp" class GitTreeEntry; @@ -85,8 +85,7 @@ class GitTreeEntry { gsl::not_null<GitCASPtr> cas_; std::string raw_id_; ObjectType type_; - mutable atomic_shared_ptr<std::optional<GitTree>> tree_cached_{nullptr}; - mutable std::atomic<bool> tree_loading_{false}; + AtomicValue<std::optional<GitTree>> tree_cached_{}; }; using GitTreePtr = std::shared_ptr<GitTree const>; |