using the wakeup_main_function together with dispatch_status_function
jim harvey
jimharvy at gmail.com
Thu Sep 25 01:02:44 PDT 2008
2008/9/25 Havoc Pennington <hp at pobox.com>
> Hi,
>
> 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.
i've currently removed the use of both functions (set_dispatch_status and
set_wakeup_main) and i'm using the
my_wakeup_main() function (which i've written as you said) to wake up the
main loop in case a new timeout/watch is toggled/added.
i use this setup and dispatch in the mainloop while DATA_REMAINS.
in this use case, is there need for any of the notifications (dispatch
status change or wakeup main)?
also - in your description of the wakeup_main function, are you implying
there is a default function called to wake
up the mainloop if i don't provide one? i haven't seen such in the source
code. Are you simply referring to what is done by the standard
DBusWatch-es mechanism?
> 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.
>
My service does not issue method calls, only responds to method calls from
clients (and issues method returns)
and omits the occasional signal. can this explain the lack of timeouts i'm
experiencing?
Regards,
Arik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20080925/29d7341d/attachment.html
More information about the dbus
mailing list