From d31310bf59a6a51945eb2d671585815b93f4df00 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Mon, 30 Sep 2024 01:31:29 +0200 Subject: libstore: turn waitForInput into a promise Change-Id: I8355d8d3f6c43a812990c1912b048e5735b07f7b --- src/libstore/build/worker.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/libstore/build/worker.cc') 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 Worker::run(std::function req) /* Wait for input. */ if (!children.isEmpty()) - waitForInput(); + waitForInput().wait(aio.waitScope).value(); else { assert(!awake.empty()); } @@ -351,8 +351,8 @@ std::vector Worker::run(std::function req) return results; } -void Worker::waitForInput() -{ +kj::Promise> 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()); } -- cgit v1.2.3