Skip to content
  • Simon McVittie's avatar
    Distinguish between two flavours of mutex · 8a58250a
    Simon McVittie authored
    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: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
    Reviewed-by: default avatarThiago Macieira <thiago@kde.org>
    8a58250a