Running dbus_connection_read_write_dispatch in a separate thread

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Tue Jun 16 22:55:19 UTC 2020


On Tue, 16 Jun 2020 18:06:34 +0300, Alexandru Sorodoc wrote:

> All works fine, but when I want to shutdown the daemon I call 
> dbus_connection_close from the main thread but 
> dbus_connection_read_write_dispatch (running in the other thread)
> never returns unless it receives a dbus message.

Best to keep all your libdbus calls on a single thread, managed as part
of your main event loop. This is easier if you use
dbus_connection_dispatch() rather than
dbus_connection_read_write_dispatch(). If you want an example you can
copy, try this <https://github.com/ldo/slow_dbus_server>.


More information about the dbus mailing list