async: context: spawn on worker thread
We always want to do async work on the worker thread. Use
the `execution::on` sender to ensure that tasks are done on that
thread no matter which thread they were spawned from.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I2b4e3a69bbd64786c2480df9396d65f12dd46cc3
diff --git a/include/sdbusplus/async/context.hpp b/include/sdbusplus/async/context.hpp
index 36671d5..3b971eb 100644
--- a/include/sdbusplus/async/context.hpp
+++ b/include/sdbusplus/async/context.hpp
@@ -69,7 +69,8 @@
throw std::logic_error(
"sdbusplus::async::context spawn called while already stopped.");
}
- pending_tasks.spawn(std::forward<Snd>(sender));
+ pending_tasks.spawn(
+ std::move(execution::on(loop.get_scheduler(), std::move(sender))));
}
bus_t& get_bus() noexcept