how does dbus know

Thiago Macieira thiago at kde.org
Tue Sep 23 07:34:03 PDT 2008


On Tuesday 23 September 2008 13:18:19 sfora dim wrote:
> My question is how does the main loop knows to wake up in order
> to call dbus ?

There's a callback function that you set in the DBusConnection that is 
supposed to wake up the mainloop, if necessary. That's up to you to implement 
it. Most mainloops keep a pipe on constant poll so that other threads can wake 
it up by just writing to the pipe.

But if the polling thread isn't holding the transport locked (i.e., it's a 
real poll(2) or select(2), not dbus_connection_read_write), then the other 
thread will attempt to send the data directly, without interfering with the 
main thread. Only if it can't will it change the status of the write Watch.

At that point, it's up to your mainloop to wake up, exit the poll, and start 
listening for writing as well.

-- 
  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/20080923/dbe7c169/attachment.pgp 


More information about the dbus mailing list