summaryrefslogtreecommitdiff
path: root/src/libelogind/sd-bus/bus-slot.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-18 21:37:03 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:49:58 +0200
commit9a24de0ce5140732f09c040073a7f6cbcad73ecf (patch)
tree27bbfe5e3c34f26d3002c3660f3763fb36d8a3ba /src/libelogind/sd-bus/bus-slot.c
parenta99096625516de3cce5d0d066b360cfa2369e5c1 (diff)
sd-bus: add asynchronous version of sd_bus_match()
We usually enqueue a number of these calls on each service initialization. Let's do this asynchronously, and thus remove synchronization points. This improves both performance behaviour and reduces the chances to deadlock.
Diffstat (limited to 'src/libelogind/sd-bus/bus-slot.c')
-rw-r--r--src/libelogind/sd-bus/bus-slot.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libelogind/sd-bus/bus-slot.c b/src/libelogind/sd-bus/bus-slot.c
index 0b5e2b7db..f7c9bfdf6 100644
--- a/src/libelogind/sd-bus/bus-slot.c
+++ b/src/libelogind/sd-bus/bus-slot.c
@@ -96,6 +96,11 @@ void bus_slot_disconnect(sd_bus_slot *slot) {
if (slot->match_added)
(void) bus_remove_match_internal(slot->bus, slot->match_callback.match_string);
+ if (slot->match_callback.install_slot) {
+ bus_slot_disconnect(slot->match_callback.install_slot);
+ slot->match_callback.install_slot = sd_bus_slot_unref(slot->match_callback.install_slot);
+ }
+
slot->bus->match_callbacks_modified = true;
bus_match_remove(&slot->bus->match_callbacks, &slot->match_callback);