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/src/async/scope.cpp b/src/async/scope.cpp
new file mode 100644
index 0000000..efdc5f6
--- /dev/null
+++ b/src/async/scope.cpp
@@ -0,0 +1,26 @@
+#include <sdbusplus/async/scope.hpp>
+
+#include <exception>
+
+namespace sdbusplus::async
+{
+scope::~scope() noexcept(false)
+{
+    if (count != 0)
+    {
+        throw std::logic_error(
+            "sdbusplus::async::scope destructed while tasks are pending.");
+    }
+}
+
+void scope::started_task() noexcept
+{
+    ++count;
+}
+
+void scope::ended_task() noexcept
+{
+    --count;
+}
+
+} // namespace sdbusplus::async