Pending reply timeout(Without glib)
Claudio Takahasi
cktakahasi at gmail.com
Thu Jun 29 06:28:35 PDT 2006
Hi,
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 :)
Some questions:
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 */
...
dbus_timeout_handle(handler->timeout);
dbus_connection_ref(connection);
/* Dispatch outgoing messages */
while (dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS);
dbus_connection_unref(connection);
...
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
timeouts?
BR,
Claudio.
--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT
More information about the dbus
mailing list