clarify docs as to dbus_connection_read_write_dispatch() behaviour
@daniels
Submitted by Daniel Stone Assigned to D-Bus Maintainers
Description
In the X server, we use D-Bus to talk to HAL, but since we (obviously) have our own main loop, we don't use D-Bus's: we listen for activity on the given fd, and call dbus_connection_read_write_dispatch(connection, 0), when we get activity. When you listen for both DeviceAdded and DeviceRemoved signals with HAL, this will only ever deliver you added, not removed. Replacing the call with the following loop: do { dbus_connection_read_write_dispatch(connection, 0); } while (dbus_connection_get_dispatch_status(connection) == DBUS_DISPATCH_DATA_REMAINS); will solve the problem.
It'd be nice if: a) dbus_connection_read_write_dispatch() noted this explicitly, and didn't assume familiarity with its internals; b) (as an optional extra) a function like dbus_connection_read_write_dispatch_until_done(), which already contains this loop, was provided.
Version: 1.5