Pending reply timeout(Without glib)
cktakahasi at gmail.com
Thu Jun 29 06:28:35 PDT 2006
Can someone help me on a small issue related to timeout for pending replies?
I am helping Marcel to implement D-Bus services for BlueZ stack. GLib
and pthread are not used to avoid dependency. Recently I realized that
timeout was not working for pending replies. The reason is simple: no
timeout function was assigned to D-Bus connection. I fixed the
problem, but I am not completely sure that this is the correct
approach and if there are side-effects that I was not able to figure
out. Work with D-Bus without GLib is a little bit confusing :)
1. Besides the send with reply, which situations a new DBusTimeout is
created/used? When it can be toggled(we don't have threads)?
2. Is it correct call the dbus_connection_dispatch inside the timeout
callback function to dispatch messages(eg: NoReply error message)?
/* timeout callback function */
/* Dispatch outgoing messages */
while (dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS);
3. Another possiblity is use dbus_connection_set_dispatch_status.
However, according to D-Bus documentation, DBusDispatchStatusFunction
should simply save an indication that messages should be dispatched
later(when the main loop is re-entered). Therefore, use
dbus_connection_set_dispatch_status_function doesn't help because it's
not allowed call dbus_connection_dispatch due to reentrancy and
because our main loop still blocked while there is not data for watch
fd or other bluetooth fds. Is there another possible design to handle
Instituto Nokia de Tecnologia - INdT
More information about the dbus