mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +02:00
Simplify the callback mechanism
This commit is contained in:
parent
1672bcd230
commit
81ea8bd5ce
16 changed files with 152 additions and 180 deletions
|
@ -33,9 +33,11 @@ void Store::computeFSClosure(const PathSet & startPaths,
|
|||
state->pending++;
|
||||
}
|
||||
|
||||
queryPathInfo(path,
|
||||
[&, path](ref<ValidPathInfo> info) {
|
||||
// FIXME: calls to isValidPath() should be async
|
||||
queryPathInfo(path, {[&, path](std::future<ref<ValidPathInfo>> fut) {
|
||||
// FIXME: calls to isValidPath() should be async
|
||||
|
||||
try {
|
||||
auto info = fut.get();
|
||||
|
||||
if (flipDirection) {
|
||||
|
||||
|
@ -75,14 +77,13 @@ void Store::computeFSClosure(const PathSet & startPaths,
|
|||
if (!--state->pending) done.notify_one();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
[&, path](std::exception_ptr exc) {
|
||||
} catch (...) {
|
||||
auto state(state_.lock());
|
||||
if (!state->exc) state->exc = exc;
|
||||
if (!state->exc) state->exc = std::current_exception();
|
||||
assert(state->pending);
|
||||
if (!--state->pending) done.notify_one();
|
||||
});
|
||||
};
|
||||
}});
|
||||
};
|
||||
|
||||
for (auto & startPath : startPaths)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue