DBus threading question

Thiago Macieira thiago at kde.org
Thu Dec 11 14:38:49 PST 2008


Schmottlach, Glenn wrote:
>So for those "uninteresting" messages that the worker thread queues
> while it's waiting for a specific reply, who ends up dispatching those
> . . . the "main" dispatch loop?

Yes. As soon as there's something to be dispatched, DBusConnection will 
invoke the callback for dispatcher status changed. You're supposed to 
handle that by calling the dbus_connection_dispatch function as soon as 
possible.

>Also, since the worker thread locks out the signal dispatch (main)
> thread while it's waiting for a reply, would it be advantageous to have
> each thread own its own connection object so there would be no
> contention on the lock? In this case, would the DBus library actually
> allow you to create two truly separate connection objects even though
> they're connecting to the same service (e.g. does it try to share the
> connection objects)?

If you create separate DBusConnection objects, they're fully independent: 
they show up as different connections on the bus as well, since they are 
different sockets.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20081211/0fa6b4e8/attachment.pgp 


More information about the dbus mailing list