Cancel dbus_connection_read_write_dispatch cleanly

Fritz Code codefritz at
Tue Jul 1 02:13:13 PDT 2008


 Im using the following construct to receive and process messages (of course
I have set up a match, and filter function).
It works well so far.
Before I open a connection with dbus_bus_get.

But If I cancel the loop by setting flag to 0, there are problems.
After doing that I unref the connection with dbus_connection_unref()
However after canceling the loop and reconnecting Im not able to receive
messages and at the same time
I have problems sending messages.
Maybe there is a better way to cancel the loop manually?

if ( dbus_connection_read_write_dispatch(conn, 500) != TRUE) )

A general question:
In general  the concept of setting up a connection by dbus_bus_get, doing
some stuff, sending and receiving messages.
When Im done I call dbus_connection_unref to close the connection.

After that I can just restart the process, right (setting up connection with
dbus_bus_get ...) ?
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the dbus mailing list