Using d-bus from multiple threads?
itb.wrk at gmail.com
Mon Aug 23 14:29:52 PDT 2010
Thank you very much for replying.
Could you perhaps give an outline of your approach and anything you did
specifically to get it to work across the threads? For example did you use
multiple private connections or one? Did you use a standard MainLoop with
the default GMainContext? Did you limit the use of proxies to specific
threads etc. etc.
On Mon, Aug 23, 2010 at 9:44 PM, Burton Samograd <burton at userful.com> wrote:
> Ivan Barr <itb.wrk at gmail.com> writes:
> > I guess I'm hearing a mixed message. On the one hand it is claimed to
> > be thread-safe under certain conditions (even though it makes use of
> > non thread safe functions?). On the other hand it appears to be
> > strongly not recommended to try to do this.
> > I guess the safest thing will be to move all the d-bus code to run in
> > a single thread. Does it matter if this is not the main thread? Sadly
> > this will be considerable re-factoring!!
> > Perhaps some warning should be put on the d-bus webpage to warn people
> > from trying to use the library with threads? It seems from what you
> > say it is not just me who has fallen into this trap...
> I've managed to get dbus to work well with a threaded application (using
> pthreads) but I did run into a lot of trouble when cancelling a thread
> that was in the middle of a dbus call. It seems that some locks can be
> held and threads can still be cancelled while holding the lock, causing
> the whole system to lock up. I got around it with a nasty do_not_cancel
> variable for the controlling thread, but it took a good day to figure
> out what was going wrong.
> The rest of the program seems to work fine and I haven't had any other
> serious problems with recieving in one thread and making calls in
> multiple others, but you might run into some more annoying problems than
> I did.
> Not sure if I would reccomend dbus threaded programming to the faint of
> heart, but it did work for me...
> Burton Samograd
> dbus mailing list
> dbus at lists.freedesktop.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the dbus