<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p><font face="DejaVu Sans">Hello,<br>
<br>
I'm trying to write a daemon that uses libdbus. I create a
private connection, register</font> a bus and an object path,
and then start a thread that calls
dbus_connection_read_write_dispatch(c, -1) in a loop (as described
in the documentation).<br>
<br>
All works fine, but when I want to shutdown the daemon I call
dbus_connection_close from the main thread but
dbus_connection_read_write_dispatch (running in the other thread)
never returns unless it receives a dbus message.<br>
<br>
Is this the expected behaviour? I did disable exiting on
disconnect:<br>
<br>
dbus_connection_set_exit_on_disconnect(c, false)<br>
<br>
But I expected that dbus_connection_close would close the
underlying socket and would cause the read_write_dispatch call to
return.<br>
<br>
The documentation says:<br>
> The loop terminates when the last message from the connection
(the disconnected signal) is processed.<br>
<br>
But also:<br>
> Note that, while it is blocked on I/O, it cannot be
interrupted (even by other threads)<br>
<br>
It's not clear to me if dbus_connection_close triggers the
"disconnected signal" and interrupts the blocking wait or if the
"disconnected signal" is only checked once before entering the
blocking wait.<br>
<br>
Also, I did call dbus_threads_init_default before any other
libdbus call.<br>
<br>
Thanks,<br>
Alex<br>
</p>
</body>
</html>