async: add scope
In order to be able to create multiple subtasks as a collection
and in order to make sure we keep good track of any tasks that
are created by the context, add a `scope` as a container of subtasks.
This is partially modelled after the C++ P2519 proposal.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I6e99b2fa2829d80c320491991f7e038f122963a9
diff --git a/test/async/context.cpp b/test/async/context.cpp
index 60d3d8d..83cfde4 100644
--- a/test/async/context.cpp
+++ b/test/async/context.cpp
@@ -8,3 +8,13 @@
ctx.run(std::execution::just() |
std::execution::then([&ctx]() { ctx.request_stop(); }));
}
+
+TEST(Context, SpawnedTask)
+{
+ sdbusplus::async::context ctx;
+
+ ctx.spawn(std::execution::just());
+
+ ctx.run(std::execution::just() |
+ std::execution::then([&ctx]() { ctx.request_stop(); }));
+}