About dbus watch functions

Thiago Macieira thiago at kde.org
Mon Jul 11 04:13:35 PDT 2011

On Monday, 11 de July de 2011 09:55:09 Simon McVittie wrote:
> You'd make life much easier for yourself if you do all interaction with
> D-Bus in one thread (either your main thread, as is traditional with
> dbus-glib, or a dedicated D-Bus thread, as is done internally by GDBus)
> and never block that thread (except in a select(), poll() or equivalent
> that includes the D-Bus fd).
> (You'd also make life much easier for yourself if you use a well-known
> main loop implementation, like GLib's GSource/GMainContext/GMainLoop
> or Qt's QCoreApplication.)

Note that QtDBus does access libdbus from several threads and from the 
experience writing that, I can't recommend as an easy solution. The watch and 
timeout functions you set will be called from *all* threads and you'll need to 
make your own re-synchronisation with your event loop thread.

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: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20110711/6f83da7d/attachment.pgp>

More information about the dbus mailing list