Dbus multiple threading problem

Simon McVittie simon.mcvittie at collabora.co.uk
Mon May 21 10:27:39 PDT 2012


On 21/05/12 16:01, Vinoth V wrote:
> I am using dbus-1.4.16 (glib binding is done using the library glib-2.30
> ) in a multi-threaded environment

Short answer: don't multi-thread with those versions. For best results,
do all your D-Bus interaction from your main thread (the one where
main() was called). You can use asynchronous method calls with callbacks
to avoid blocking your main thread.

If you're using libdbus (dbus_* functions) in your multi-threaded
application, libdbus 1.4.16 has known thread-safety bugs. They were
fixed in 1.5.10, so in principle, what you're doing might work with that
version. I am not aware of any thread-safety bugs in 1.5.10 or newer,
but that doesn't mean there aren't any!

If you're using GDBus (g_dbus_* or g_bus_* functions) in your
multi-threaded application, the version of GDBus in GLib 2.30 also has
known thread-safety bugs. They were fixed in 2.32. In general GDBus has
a pretty good design for thread-safety, so if you must use D-Bus from
multiple threads, it's a good choice.

If you're using dbus-glib (dbus_g_* functions) in your multi-threaded
application, don't. It isn't thread safe and never will be. It also has
serious design flaws, and I recommend using GDBus instead.

    S


More information about the dbus mailing list