tree-wide: install matches asynchronously

Let's remove a number of synchronization points from our service
startups: let's drop synchronous match installation, and let's opt for
asynchronous instead.

Also, let's use sd_bus_match_signal() instead of sd_bus_add_match()
where we can.
This commit is contained in:
Lennart Poettering
2018-01-05 13:58:32 +01:00
parent 0c0b930647
commit 75152a4d6a
14 changed files with 183 additions and 196 deletions
+8 -7
View File
@@ -2905,7 +2905,6 @@ static int start_unit_one(
if (wait_context) {
_cleanup_free_ char *unit_path = NULL;
const char* mt;
log_debug("Watching for property changes of %s", name);
r = sd_bus_call_method(
@@ -2928,13 +2927,15 @@ static int start_unit_one(
if (r < 0)
return log_error_errno(r, "Failed to add unit path %s to set: %m", unit_path);
mt = strjoina("type='signal',"
"interface='org.freedesktop.DBus.Properties',"
"path='", unit_path, "',"
"member='PropertiesChanged'");
r = sd_bus_add_match(bus, &wait_context->match, mt, on_properties_changed, wait_context);
r = sd_bus_match_signal_async(bus,
&wait_context->match,
NULL,
unit_path,
"org.freedesktop.DBus.Properties",
"PropertiesChanged",
on_properties_changed, NULL, wait_context);
if (r < 0)
return log_error_errno(r, "Failed to add match for PropertiesChanged signal: %m");
return log_error_errno(r, "Failed to request match for PropertiesChanged signal: %m");
}
log_debug("%s manager for %s on %s, %s",