async: context: use transfer instead of schedule
Later revisions of the stdexec proposal added a `transfer` method
that allows us to reduce 1 co_await.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: If43877a85254b5572cc2a3a1cacdf6b580870b5a
diff --git a/src/async/context.cpp b/src/async/context.cpp
index 8ddbe58..ad45c4d 100644
--- a/src/async/context.cpp
+++ b/src/async/context.cpp
@@ -101,12 +101,10 @@
{
while (!ctx.final_stop.stop_requested())
{
- // Handle the next sdbus event.
- co_await wait_process_sender(ctx);
-
- // Completion likely happened on the context 'caller' thread, so
- // we need to switch to the worker thread.
- co_await execution::schedule(ctx.loop.get_scheduler());
+ // Handle the next sdbus event. Completion likely happened on a
+ // different thread so we need to transfer back to the worker thread.
+ co_await execution::transfer(wait_process_sender(ctx),
+ ctx.loop.get_scheduler());
}
{