[systemd-devel] sd_bus_add_match callback
Lennart Poettering
lennart at poettering.net
Wed May 6 14:19:13 UTC 2020
On Fr, 10.04.20 12:06, David J (emacsd at icloud.com) wrote:
> Giacinto,
> Thanks for further explaining my email.
>
> Lennart,
> Thank you for your feedback. What I am doing is writing an sd-bus
> interface and a client code, which is only interested in specific
> signal information. So the interface has to offer minimal API’s. The
> interface has one callback to handle all the signal callbacks,
> processes the messages and populates the information for the client
> code. If you have a better resolution please share.
"one callback to handle all the signal callbacks"? Not getting it?
You can register the same function as many times as you want for
different match expressions with different (and with the same, too)
user data ptr, it's up to you. What function you pass and what
userdata ptr you pass is entirely your own choice. All sd-bus ensures
is that for every matching incoming signal message your function will
be called as many times as it is registered.
i.e. if you'd use sd_bus_add_match() five times in a row with the
identical callback function ptrs and userdata ptrs then for each
matching incoming signal msg your function would be called five times,
each time with the same userdata ptr, i.e. the one you specified.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list