Multithreading with QtDBus

Thiago Macieira thiago at
Thu Nov 1 09:25:59 PDT 2012

On quinta-feira, 1 de novembro de 2012 17.55.23, Ville M. Vainio wrote:
> On Thu, Nov 1, 2012 at 5:05 PM, Thiago Macieira <thiago at> 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:
> 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.

2009 was before the fix to the major issue, which was that the library dropped 
locks before calling some callbacks but then couldn't continue due to state 
changing. We fixed that by not dropping the lock and requiring the callback not 
to reenter.

But I tell you the architecture is fine. There's no need to change it. If there 
are bugs, we fix them.

In particular, the one that Nick is having seems to be in QtDBus itself.

Thiago Macieira - thiago (AT) - thiago (AT)
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the dbus mailing list