Multithreading with QtDBus
Ville M. Vainio
vivainio at gmail.com
Thu Nov 1 08:55:23 PDT 2012
On Thu, Nov 1, 2012 at 5:05 PM, Thiago Macieira <thiago at kde.org> wrote:
>> To be safe, ensure everything that touches dbus happens in the
>> applications main loop.
>
> That's incorrect.
>
> D-Bus is thread-safe and has been for years. QtDBus makes good use of it and
> has supported multiple threads since 2007. Sure, there have been bugs, like
> this one, and like one that was very serious, but there is no design issue
> that would make thread safety impossible.
Thread safety may be possible, but I would still advice against being
excessively optimistic about getting it working safely.
My experience dates back to 2009, when I had problems like this:
http://lists.freedesktop.org/archives/dbus/2009-February/010945.html
Back then, IIRC the advise (not visible on public mailing lists) was
that people generally avoid using multithreaded dbus in production,
it's known to have bugs, and that you'll be much safer if you can get
rid of the multithreading on parts of the program interfacing with
dbus.
There have been several discussions after that, e.g. about possibility
of changing the dbus architecture to use "worker threads" to make it
safer, but I don't know whether it has led anywhere.
More information about the dbus
mailing list