Using dbus from multiple threads

David Faure faure at kde.org
Wed Sep 22 11:00:06 BST 2010


While QtDBus is threadsafe, there's a bug in libdbus < 1.4 which makes 
applications misbehave when using QDBusConnection::sessionBus() from multiple 
threads.

For this reason, kdelibs/nepomuk has a DBusConnectionPool, which provides one 
dbus connection (to the session bus) per thread.

Now the akonadi guys are having the same problem, and are about to put a copy 
of dbusconnectionpool in kdepimlibs/akonadi, at my advice.

That's two users, would there be any others?

In that case we could have a KDBusConnectionPool in kdecore, with a BusType 
argument added to the current code, so that solid can maybe use this for the 
SystemBus as well.

The main downside of this, is that this is all a "temporary" workaround until 
everyone uses libdbus >= 1.4. But this might take quite some time, so I think 
we should still have this. We can always deprecate it in a few years, won't be 
the first time.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).




More information about the kde-core-devel mailing list