Distinguish between two flavours of mutex
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 14 Feb 2012 19:58:56 +0000 (19:58 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 21 Feb 2012 14:41:25 +0000 (14:41 +0000)
commit8a58250acfeffc4e311169903f9e782fcad79547
tree47360102b46407d931a9e4a9e1a55e13683b3f8b
parent4d4da20ce7e4eebc6b4467d193cb7cec4cfeb17a
Distinguish between two flavours of mutex

dbus-threads.h warns that recursive pthreads mutexes are not compatible
with our expectations for condition variables. However, the only two
condition variables we actually use only have their corresponding
mutexes locked briefly (and we don't call out to user code from there),
so the mutexes don't need to be recursive anyway. That's just as well,
because it turns out our implementation of recursive mutexes on
pthreads is broken!

The goal here is to be able to distinguish between "cmutexes" (mutexes
compatible with a condition variable) and "rmutexes" (mutexes which
are recursive if possible, to avoid deadlocking if we hold them while
calling user code).

This is complicated by the fact that callers are not guaranteed to have
provided us with both versions of mutexes, so we might have to implement
one by using the other (in particular, DBusRMutex *aims to be*
recursive, it is not *guaranteed to be* recursive).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=43744
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
dbus/dbus-connection.c
dbus/dbus-dataslot.c
dbus/dbus-dataslot.h
dbus/dbus-internals.h
dbus/dbus-server-protected.h
dbus/dbus-server.c
dbus/dbus-threads-internal.h
dbus/dbus-threads.c