Sending new messages from a signal handler

Havoc Pennington hp at pobox.com
Thu Dec 4 14:22:58 PST 2008


Hi,

The docs currently read "Be careful about calling
dbus_connection_dispatch() from inside a message handler, i.e. calling
dbus_connection_dispatch() recursively. If threads have been
initialized with a recursive mutex function, then this will not
deadlock; however, it can certainly confuse your application."

Reading code, the mutex in DBusConnection appears to be dropped when
calling out to application handlers. But I don't remember why we added
recursive mutexes if that's the case. Doesn't make sense.

Some unenlightening historical thread:
http://lists.freedesktop.org/archives/dbus/2006-February/004128.html

I think there's probably a more-enlightening old email but I can't find it.

I would suggest getting a backtrace from your deadlock and that will
help us all understand the exact problem.

(side note: recursive dispatch, or as it sounds like you're doing, a
recursive mainloop, can be extremely dangerous and unpredictable, even
if we make it not deadlock)

Havoc


More information about the dbus mailing list