From 14c6648c71b4b8a12ac0905ff23fcd4de7f0556f Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Mon, 13 Jun 2022 13:30:13 +0200 Subject: 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. --- src/buildtool/file_system/git_tree.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/buildtool/file_system/git_tree.hpp') 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 cas_; std::string raw_id_; ObjectType type_; - mutable atomic_shared_ptr> tree_cached_{nullptr}; - mutable std::atomic tree_loading_{false}; + AtomicValue> tree_cached_{}; }; using GitTreePtr = std::shared_ptr; -- cgit v1.2.3