using the wakeup_main_function together with dispatch_status_function

Havoc Pennington hp at pobox.com
Wed Sep 24 22:06:10 PDT 2008


Hi,

On Wed, Sep 24, 2008 at 4:51 AM, jim harvey <jimharvy at gmail.com> wrote:
> it seems to me that both of these functions are called when there is a new
> message in the incoming/outgoing queue.
> is one preferable to the other? or should i leave both?

wakeup_main writes a byte to a pipe that the main loop is blocking on,
to wake up the main loop thread from another thread. In theory it
could probably be called at different times than dispatch status, I
don't know if it in practice is right now or not, since the usual
reason to wake up the main loop thread is that the main loop thread
needs to dispatch. The dispatch status function is defined to be
called when get_dispatch_status would now return a different value.

Anyway, you could look at the source and see if they are always called
together, but it might be just as easy to just set both, and they
aren't guaranteed to always be called together in future versions.

> also an aside question: i've implemented the mainloop without timeouts (i
> have stubs with debug_prints for the add_timeout/remove_timeout functions).
> using the debug prints, i dont see these functions called during the
> operation of the service. is imeplementing timeouts mandatory?

They are used by DBusPendingCall for example to time out a method call.

Havoc


More information about the dbus mailing list