Async DBusMessage reads using the C API

Matthew Johnson dbus at matthew.ath.cx
Fri Nov 4 09:49:21 PST 2005


On Fri, 4 Nov 2005, Havoc Pennington wrote:

> I think the right patch is probably:
> - make the body of read_write_dispatch() into a private function
>   that takes a "dbus_bool_t dispatch" argument
> - wrap it in two public functions, one that calls it with TRUE
>   and another that calls with with FALSE
>
> i.e. this is exactly like read_write_dispatch except it never
> dispatches.
>
I have a patch that does it like that with a separate function. I agree
though, thats sensible. I have a question about the current
implementation of read_write_dispatch though, it seems to do the
dispatch before  the read_write iteration, shouldn't it be the other way
round---otherwise things are read off the wire and not dispatched until
the next call to read_write_dispatch()? Also, it appears to not do a
read_write iteration if there is data to dispatch, so it either
read_writes, or dispatches---rather than both, as I would expect.

I'd expect it to work more like:

    do_iteration(timeout);
    if (dispatch && has_data) dispatch();

Matt

-- 
Matthew Johnson
http://www.matthew.ath.cx/


More information about the dbus mailing list