libdbus vs libgio

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Sep 10 02:26:05 PDT 2012


On 09/09/12 22:08, Matthias Clasen wrote:
> libdbus has its problems, e.g. wrt to threads.

As a D-Bus maintainer and occasional GLib contributor, I consider GIO's
GDBus to be a higher-quality D-Bus implementation for general
applications than the libdbus reference implementation (and doubly so if
you multi-thread).

libdbus remains a necessary evil if your application must survive
malloc() returning NULL (e.g. the system bus, Upstart or systemd),
although on Linux that basically never happens; if it does, nobody
handles it correctly anyway[1]; and even libdbus, with its relatively
thorough OOM-testing, doesn't always get it right[2][3][4][5][etc.]. The
fact that GIO follows GLib's "if malloc() returns NULL, just give up"
policy improves its quality considerably.

dbus-glib is considerably worse than libdbus, and in particular, it is
not at all thread-safe. I do not recommend it for anything that isn't
already constrained to use it by a large public API "surface area" (i.e.
telepathy-glib - we're working towards moving that to GDBus, but it's
going to take a while).

    S

[1] http://log.ometer.com/2008-02.html#4.2
[2] https://bugs.freedesktop.org/show_bug.cgi?id=51032
[3] https://bugs.freedesktop.org/show_bug.cgi?id=29881
[4] https://bugs.freedesktop.org/show_bug.cgi?id=33128
[5] https://bugs.freedesktop.org/show_bug.cgi?id=33126


More information about the dbus mailing list