Async DBusMessage reads using the C API

Matthew Johnson dbus at matthew.ath.cx
Fri Nov 4 02:25:58 PST 2005


On Thu, 3 Nov 2005, Robert McQueen wrote:

> John (J5) Palmieri wrote:
>> Question about that, does the timeout generate an error on the bus like
>> normal timeouts (i.e. does read_write_dispatch dispatch an error
>> message)?
>
> No, this timeout is just if you *don't* recieve a message, so there's
> nothing to reply to. It's just to return control to the application
> using the function so you can eg go and poll something else. Like:
>
> while (1) {
>   check_some_non_dbus_source_of_events();
>   dbus_connection_read_write_dispatch(sleep me for 500ms);
> }

Exactly. The function definition would therefore be:

void dbus_connection_read_write(DBusConnection* conn, dbus_uint32_t ms);

We could also have it return a dbus_bool_t, true if the incoming queue
is now non-empty? That can be checked when you pop_message though, so
its less vital.

I'm happy to try and implement the blocking stuff, but I suspect others
may be able to do so a lot easier. Some pointers as to useful functions
would be good at the very least.

Matt

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


More information about the dbus mailing list