1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-21 09:49:36 +01:00

LocalStore::State: Put behind a ref to reduce false sharing

This commit is contained in:
Eelco Dolstra 2025-09-04 12:08:25 +02:00
parent 9ff427d7ba
commit e791ede495
3 changed files with 25 additions and 37 deletions

View file

@ -931,7 +931,7 @@ void LocalStore::autoGC(bool sync)
std::shared_future<void> future;
{
auto state(_state.lock());
auto state(_state->lock());
if (state->gcRunning) {
future = state->gcFuture;
@ -964,7 +964,7 @@ void LocalStore::autoGC(bool sync)
/* Wake up any threads waiting for the auto-GC to finish. */
Finally wakeup([&]() {
auto state(_state.lock());
auto state(_state->lock());
state->gcRunning = false;
state->lastGCCheck = std::chrono::steady_clock::now();
promise.set_value();
@ -979,7 +979,7 @@ void LocalStore::autoGC(bool sync)
collectGarbage(options, results);
_state.lock()->availAfterGC = getAvail();
_state->lock()->availAfterGC = getAvail();
} catch (...) {
// FIXME: we could propagate the exception to the