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
+9 -7
View File
@@ -3622,14 +3622,16 @@ static int run(int master,
* case PID 1 will send us a friendly RequestStop signal, when it is asked to terminate the
* scope. Let's hook into that, and cleanly shut down the container, and print a friendly message. */
r = sd_bus_add_match(bus, NULL,
"type='signal',"
"sender='org.freedesktop.systemd1',"
"interface='org.freedesktop.systemd1.Scope',"
"member='RequestStop'",
on_request_stop, PID_TO_PTR(*pid));
r = sd_bus_match_signal_async(
bus,
NULL,
"org.freedesktop.systemd1",
NULL,
"org.freedesktop.systemd1.Scope",
"RequestStop",
on_request_stop, NULL, PID_TO_PTR(*pid));
if (r < 0)
return log_error_errno(r, "Failed to install request stop match: %m");
return log_error_errno(r, "Failed to request RequestStop match: %m");
}
if (arg_register) {