mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 10:46:15 +02:00
Pull fut.get() out of the lock
This is https://gerrit.lix.systems/c/lix/+/1462 by @jade_ see: https://git.lix.systems/lix-project/lix/issues/366 see: https://gerrit.lix.systems/c/lix/+/1462
This commit is contained in:
parent
1073a8effa
commit
46f6505865
1 changed files with 14 additions and 3 deletions
|
@ -822,14 +822,25 @@ StorePathSet Store::queryValidPaths(const StorePathSet & paths, SubstituteFlag m
|
||||||
auto doQuery = [&](const StorePath & path) {
|
auto doQuery = [&](const StorePath & path) {
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
queryPathInfo(path, {[path, &state_, &wakeup](std::future<ref<const ValidPathInfo>> fut) {
|
queryPathInfo(path, {[path, &state_, &wakeup](std::future<ref<const ValidPathInfo>> fut) {
|
||||||
auto state(state_.lock());
|
bool exists = false;
|
||||||
|
std::exception_ptr newExc{};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto info = fut.get();
|
auto info = fut.get();
|
||||||
state->valid.insert(path);
|
exists = true;
|
||||||
} catch (InvalidPath &) {
|
} catch (InvalidPath &) {
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
state->exc = std::current_exception();
|
newExc = std::current_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto state(state_.lock());
|
||||||
|
|
||||||
|
if (exists)
|
||||||
|
state->valid.insert(path);
|
||||||
|
|
||||||
|
if (newExc != nullptr)
|
||||||
|
state->exc = newExc;
|
||||||
|
|
||||||
assert(state->left);
|
assert(state->left);
|
||||||
if (!--state->left)
|
if (!--state->left)
|
||||||
wakeup.notify_one();
|
wakeup.notify_one();
|
||||||
|
|
Loading…
Reference in a new issue