Similar Question was asked at DBusWatch and DBusTimeout examples but the reason was not given?
Can anyone please explain, Why to use DBusWatch functions when dbus_connection_read_write_dispatch() can read and write ?
Similar Question was asked at DBusWatch and DBusTimeout examples but the reason was not given?
Can anyone please explain, Why to use DBusWatch functions when dbus_connection_read_write_dispatch() can read and write ?
The DBUS documentation for "dbus_connection_read_write_dispatch()" says:
The way to think of this function is that it either makes some sort of progress, or it blocks. Note that, while it is blocked on I/O, it cannot be interrupted (even by other threads), which makes this function unsuitable for applications that do more than just react to received messages.
In a typical real application it needs to handle events from multiple sources. For example it may take keyboard input and convert the input into a database query sent over DBUS. If the program blocks on DBUS event it would not be able to take the keyboard input.
The function itself does not do the read/write, it is the main loop dispatching part of the read/write process.