[systemd-devel] sd_bus_add_match callback
David J
emacsd at icloud.com
Fri Apr 10 16:06:59 UTC 2020
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.
Side note: I really enjoyed using the sd-bus API’s! Thank you for the awesome library.
DJ
Sent from my iPhone
> On Apr 10, 2020, at 10:51 AM, Giacinto Cifelli <gciofono at gmail.com> wrote:
>
> hi Lennart,
>
>> On Fri, Apr 10, 2020 at 2:14 PM Lennart Poettering
>> <lennart at poettering.net> wrote:
>>
>>> On Do, 09.04.20 14:12, David J (emacsd at icloud.com) wrote:
>>>
>>> Hello Systemd developers!
>>>
>>>> I asked this question earlier but I haven’t gotten any reply so I thought asking again.
>>>
>>>> Question regarding sd_bus_add_match (sd-bus.c):
>>>>
>>>> Is there any bad consequences to use the same callback for
>>>> multiple signal match and then using the userdata parameter to
>>>> distinguish among the different signals? See the sample code below
>>>> for a reference of what I am trying to do.
>>
>> No sure why one would do that, but the userdata argument is something
>> you can use any way you like. Most people stick some context object
>> pointer in it, but it's entirely fine to place anything else there,
>> for example an enum that you cast to a pointer.
>
> If I understand correctly David's question, he wants to know if he got
> triggered twice on the same event in a single client.
> I am also interested because it could be simple for some application
> to be triggered by two events instead than re-firing a message
> internally.
>
>>
>> Lennart
>>
>> --
>> Lennart Poettering, Berlin
>> _______________________________________________
>> systemd-devel mailing list
>> systemd-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
> Thank you,
> Giacinto
More information about the systemd-devel
mailing list