Blocking behavior of synchronous calls
hp at pobox.com
Sat Nov 22 06:54:27 PST 2008
On Fri, Nov 21, 2008 at 12:28 PM, Macartney, Geoff
<gmacartney at tycoint.com> wrote:
> Are there any apps that use the multi-threads-sharing-connection model
> succesfully? I assumed dbus just worked in a multithreaded environment.
Threads rarely "just work" - they at least require some thought ... in
the dbus case, for example, if you dispatch incoming messages from
multiple threads that will be mass chaos.
What is intended to work is that you can have one thread running a
main loop doing the dispatch of all incoming messages, and other
threads can send messages and block for the replies to those messages.
But, almost everyone using dbus uses a main loop only. So if you try
out the thread stuff, you may hit some issues, just because you're
pioneering a little bit.
The intent is to use dbus from a binding and that the binding would
use threads if it so desired. I don't think any of the current ones do
since they are all designed for frameworks with main loops.
There is not a great C binding out there; personally I use various
cut-and-pasted helper functions, rather than an existing C binding.
More information about the dbus