mirror of
https://github.com/NixOS/nix
synced 2024-09-19 10:50:24 -04:00
Merge pull request #11424 from kjeremy/lix-1462
Pull fut.get() out of the lock
This commit is contained in:
commit
668d63d8dd
|
@ -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)
|
||||||
|
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