diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-03-31 21:49:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-31 21:49:20 -0400 |
commit | 8ae9d669409851acb6de39335b11a95a991eae6d (patch) | |
tree | 69bd4e1c8c24f9f0cd96130be3f8077dc9f9ce12 /src/libstore | |
parent | cf76b38e27c1880479b9631844a58ce4ec9c3c38 (diff) | |
parent | 2b905d1d35af7fbdba391f0f0d8d7a28a3d703e8 (diff) |
Merge pull request #8142 from patricksjackson/atomic-sync
Replace unnecessary Sync<uint64_t> with std::atomic<uint64_t>
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/store-api.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 3cf4c801b..60e87918a 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -10,7 +10,6 @@ #include "archive.hh" #include "callback.hh" #include "remote-store.hh" -#include "sync.hh" #include <nlohmann/json.hpp> #include <regex> @@ -1103,7 +1102,7 @@ std::map<StorePath, StorePath> copyPaths( }; // total is accessed by each copy, which are each handled in separate threads - Sync<uint64_t> _total = 0; + std::atomic<uint64_t> total = 0; for (auto & missingPath : sortedMissing) { auto info = srcStore.queryPathInfo(missingPath); @@ -1126,9 +1125,8 @@ std::map<StorePath, StorePath> copyPaths( PushActivity pact(act.id); LambdaSink progressSink([&](std::string_view data) { - auto total(_total.lock()); - *total += data.size(); - act.progress(*total, info->narSize); + total += data.size(); + act.progress(total, info->narSize); }); TeeSink tee { sink, progressSink }; |