On Fr, 16.11.18 08:02, Fabian Knapp (knapp@xxxxxxxxxx) wrote: > I have an executable that opens a dbus connection with > sd_bus_open_system at init time and cleanup and close this > connection only on exit. > > This connection is used in multiple threads (in a thread safe > manner) and im wondering if this is suitable since sd_bus_add_match > seems to time out if the sd_bus* object is created from another > thread than the call to sd_bus_add_match happens. sd-bus is not thread-safe. If you want to share connections between threads you have to add a lock around it, which you need to allocate yourself, and take whenever you access the bus and release it right after. I'd generally suggest using one connection per thread though, but this has drawbacks (no global ordering and so on), so it really matters on your usecase. But key really is: whatever you do, if you do use the same bus object from multiple threads you need to lock around it, sd-bus is not thread-safe on is own. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel