using the wakeup_main_function together with dispatch_status_function

Havoc Pennington hp at pobox.com
Fri Sep 26 06:12:37 PDT 2008


Hi,

On Fri, Sep 26, 2008 at 12:43 AM, jim harvey <jimharvy at gmail.com> wrote:
> concerning the sending of a message from another thread - i think a more
> elegant solution would be to use an internal function like:
>
> send_msg(conn,msg)
> {
>    dbus_connection_send(conn,msg,0);
>    my_wakeup_mainloop();
> }

That makes every module and library in an application process be aware
of this send_msg() and use it instead of dbus_connection_send()

Also, some API like dbus_bus_add_match() calls send() for you, as
Thiago mentions

> Now the DBusWatches + watch_add/watch_toggle handle incoming messages wakeup
> and i manually handle outgoing messages wakeup.
> is there still reason to implement the dispatch functions?

Look, it just is not correct to ask whether you "must" implement the
dispatch functions, given some specific combination of details of what
API you're using right now and how dbus works right now. The API
contract is that you must implement them. If you want to rely on the
specifics for right now, then you have to read all the source of
libdbus and your app and figure out what pertains right now. I have no
idea. But, it's easier and more robust and correct to just follow the
API contract.

Havoc


More information about the dbus mailing list