Race condition in send_with_reply_and_block()

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Jul 31 12:20:35 PDT 2014


On 31/07/14 18:31, Alan S wrote:
> Sorry to resurrect such an old thread, but what is the current state of
> multi-threading in libdbus. Is it the case that using a separate
> DBusConnection in each thread can be considered safe or is it still
> "anyone's guess"?

It's *meant* to work; but if it doesn't, and you're relying on it, then
you are likely to end up being the one debugging and fixing it.

In order with "most likely to work" first:

* GDBus, which is designed to be safe to use multi-threaded, even
  with a GDBusConnection shared between threads (it can do better than
  libdbus by assuming you use the GLib main-loop abstraction, which
  simplifies a lot of things for it)

* one "private" libdbus DBusConnection per thread, dispatched by that
  thread, and only touched by that thread

* sharing DBusConnections between threads

* [ imagine a very large gap here ]

* [ no, larger than that ]

* dbus-glib, which is known not to be safe for use from threads other
  than the main thread, and is pretty terrible in general

Regards,
    S



More information about the dbus mailing list