Fwd: Re: Race condition in send_with_reply_and_block()
rony at wu.ac.at
Wed Jul 24 08:24:48 PDT 2013
On 23.07.2013 18:18, Glenn Schmottlach wrote:
> 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.
thank you for your hints, will have to think about what would be best to do!
More information about the dbus