[systemd-devel] sd_bus_add_match after sd_bus_get_fd

Federico Di Pierro nierro92 at gmail.com
Sun Apr 30 11:25:41 UTC 2017


Thanks, that was the information i was looking for.
Indeed i was able to solve the issue!
Again, thank you very much,

Federico

2017-04-30 12:55 GMT+02:00 Lennart Poettering <lennart at poettering.net>:

> On Sat, 29.04.17 20:31, Federico Di Pierro (nierro92 at gmail.com) wrote:
>
> > Hi!
> > I'm struggling to understand if this can be done: suppose i start polling
> > on sd_bus_get_fd() without any match; then, after some event happens, i
> add
> > a match on same bus.
> > Will i receive events on my fd just going on polling?
> > Ie: will this work?
> > fd = sd_bus_get_fd();
> > event_happened = 0;
> > poll(fd);
> > if (event_happened) sd_bus_process();
> > else sd_bus_process(); sd_bus_add_match();
> >
> > It seems it is not working, but i cannot understand if my idea is
> > completely wrong or if something else is happening.
> > I mean, fd is still the same obviously, i am only telling sd_bus that i'm
> > now interested in certain messages, by hooking a callback; am i mistaken?
>
> I am not sure I follow what you are trying to say.
>
> But yes, you can add and remove matches on an existing connectio any
> time, and you'll get events from the matches from the moment you
> install it on until you remove it again (or the connection is
> terminated).
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170430/e11a315a/attachment.html>


More information about the systemd-devel mailing list