async: add match

Define a class which will register for a dbus signal match
and generate Senders that await new signals.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib1d77708d74e6063bcaa08fc76fb98667ee7a2cb
diff --git a/example/coroutine-example.cpp b/example/coroutine-example.cpp
index 8cfa0f4..2013771 100644
--- a/example/coroutine-example.cpp
+++ b/example/coroutine-example.cpp
@@ -69,6 +69,26 @@
                   << e.what() << std::endl;
     }
 
+    // Create a match for the NameOwnerChanged signal.
+    namespace rules = sdbusplus::bus::match::rules;
+    auto match = sdbusplus::async::match(ctx, rules::nameOwnerChanged());
+
+    // Listen for the signal 4 times...
+    for (size_t i = 0; i < 4; ++i)
+    {
+        auto [service, old_name, new_name] =
+            co_await match.next<std::string, std::string, std::string>();
+
+        if (!new_name.empty())
+        {
+            std::cout << new_name << " owns " << service << std::endl;
+        }
+        else
+        {
+            std::cout << service << " released" << std::endl;
+        }
+    };
+
     co_return;
 }