Fwd: Re: Race condition in send_with_reply_and_block()

Glenn Schmottlach gschmottlach at gmail.com
Tue Jul 23 09:18:17 PDT 2013

In my experience, mixing access to D-Bus with multiple threads is generally
a "bad idea". My experiences have been with the reference library (libdbus)
and when used correctly (without access from different threads) it has
proven to be quite robust. I've written my own Lua binding to the reference
library and adhered to an asynchronous design pattern with a main-loop and
single threaded architecture. This isn't the first binding I've done but
early on the non-deterministic nature of using libdbus from multiple
threads became painfully obvious. I have absolutely no experience with
GDBus so I can't comment on the robustness of it's multi-threaded
implementation. In general, however, I try to avoid using multiple threads
with some of these large libraries whether they're for communication or
graphics. Generally, have one thread that utilize the API and marshall the
requests/responses (from different threads) over a synchronized channel.
This approach has always worked well for me and reduced the time I've spent
scratching my head and wondering why I'm seeing an unexpected seg-fault or
(apparent) out-of-order execution.

Good luck with your efforts to use D-Bus from multiple threads . . . but if
you have the opportunity, you may want to reconsider your approach . . .
and certainly a different library than the reference one if you're stuck
having multiple threads access the API.

On Tue, Jul 23, 2013 at 9:51 AM, Emmanuele Bassi <ebassi at gmail.com> wrote:

> hi;
> On 23 July 2013 13:47, Simon McVittie <simon.mcvittie at collabora.co.uk>
> wrote:
> >> As long as GDBus is not the official reference implementation for DBus
> being available on all major
> >> operating systems (including Windows and MacOSX), I feel forced to
> stick to libdbus
> >
> > Please do not feel forced to stick to libdbus. Being the *reference*
> > implementation does not mean that it is the *best* implementation.
> also, GDBus is available (and working) on Windows and MacOS.
> ciao,
>  Emmanuele.
> --
> W: http://www.emmanuelebassi.name
> B: http://blogs.gnome.org/ebassi/
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20130723/5a41778b/attachment-0001.html>

More information about the dbus mailing list