async: scope: add completion sender

Add a mechanism to await the completion of an async::scope,
equivalent to a 'join' on the spawned tasks it contains.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I669680441704cdb59aa982d97bed610178c498b9
diff --git a/src/async/context.cpp b/src/async/context.cpp
index 38d3a89..60d9e56 100644
--- a/src/async/context.cpp
+++ b/src/async/context.cpp
@@ -150,6 +150,9 @@
         details::wait_process_completion::wait_once(*this);
     }
 
+    // Wait for all the tasks to complete.
+    std::this_thread::sync_wait(pending_tasks.empty());
+
     // Stop has been requested, so finish up the loop.
     loop.finish();
     if (worker_thread.joinable())