openbmc / sdbusplus

C++ bindings for systemd dbus APIs
Apache License 2.0
104 stars 82 forks source link

is this library thread safe? #28

Closed flyingsheeplp closed 4 years ago

wak-google commented 5 years ago

My understanding about libsystemd sd_bus is that all of the interfaces are thread compatible. If you share an sd_bus or sd_bus_message to different threads you will need to use your own locking. Calling sd_bus_default() on different threads will use thread local storage to provide a unique bus object per thread. sd_bus_new() will always return a new, unique bus connection. So long as you aren't sharing those, you shouldn't need to add any locking around them.

Our code lightly wraps the underlying implementation so it should map similarly to the above.