aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-09-30 01:31:29 +0200
committereldritch horrors <pennae@lix.systems>2024-10-01 11:36:45 +0000
commitd31310bf59a6a51945eb2d671585815b93f4df00 (patch)
tree6e74fa81739749d4219f9d274f84a990856c5c42 /src
parent8e05cc1e6c5eb1729e06835baf9114c4be8b82ee (diff)
libstore: turn waitForInput into a promise
Change-Id: I8355d8d3f6c43a812990c1912b048e5735b07f7b
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build/worker.cc11
-rw-r--r--src/libstore/build/worker.hh2
2 files changed, 8 insertions, 5 deletions
diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc
index 3a49e8ef9..7dd75f34a 100644
--- a/src/libstore/build/worker.cc
+++ b/src/libstore/build/worker.cc
@@ -328,7 +328,7 @@ std::vector<GoalPtr> Worker::run(std::function<Targets (GoalFactory &)> req)
/* Wait for input. */
if (!children.isEmpty())
- waitForInput();
+ waitForInput().wait(aio.waitScope).value();
else {
assert(!awake.empty());
}
@@ -351,8 +351,8 @@ std::vector<GoalPtr> Worker::run(std::function<Targets (GoalFactory &)> req)
return results;
}
-void Worker::waitForInput()
-{
+kj::Promise<Result<void>> Worker::waitForInput()
+try {
printMsg(lvlVomit, "waiting for children");
auto waitFor = [&]{
@@ -366,7 +366,10 @@ void Worker::waitForInput()
waitFor = waitFor.exclusiveJoin(aio.provider->getTimer().afterDelay(10 * kj::SECONDS));
}
- waitFor.wait(aio.waitScope);
+ co_await waitFor;
+ co_return result::success();
+} catch (...) {
+ co_return result::failure(std::current_exception());
}
diff --git a/src/libstore/build/worker.hh b/src/libstore/build/worker.hh
index 1953bbec1..02b98b3aa 100644
--- a/src/libstore/build/worker.hh
+++ b/src/libstore/build/worker.hh
@@ -156,7 +156,7 @@ private:
/**
* Wait for input to become available.
*/
- void waitForInput();
+ kj::Promise<Result<void>> waitForInput();
/**
* Remove a dead goal.