how does dbus know

jim harvey jimharvy at
Thu Sep 25 04:06:00 PDT 2008

> From: Thiago Macieira <thiago at>
> Date: Tue, Sep 23, 2008 at 5:34 PM
> Subject: Re: how does dbus know
> To: dbus at
> 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.

let me get this straight - lets say I use poll() and have a multi threaded
application, with many threads performing
methods calls. when a thread (not the main) sends a message, will one of the
FDs in the DBusWatch structures
i'm poll()-ing on get signalled?
or must i use the set_wakeup_main_function to set a my_wakeup_main()
function that manually wakes up the main thread
from the poll() (via a dedicated FD i am signaling)?

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the dbus mailing list