From fd34de63e4781ea0660a4691f33799ac89935fd7 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 12 Mar 2016 09:59:04 +0100 Subject: [PATCH] Mutex: Use PTHREAD_PRIO_INHERIT protocol --- distrho/extra/Mutex.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/distrho/extra/Mutex.hpp b/distrho/extra/Mutex.hpp index 3abd478a..ea5cc004 100644 --- a/distrho/extra/Mutex.hpp +++ b/distrho/extra/Mutex.hpp @@ -40,7 +40,12 @@ public: Mutex() noexcept : fMutex() { - pthread_mutex_init(&fMutex, nullptr); + pthread_mutexattr_t atts; + pthread_mutexattr_init(&atts); + pthread_mutexattr_setprotocol(&atts, PTHREAD_PRIO_INHERIT); + pthread_mutexattr_settype(&atts, PTHREAD_MUTEX_NORMAL); + pthread_mutex_init(&fMutex, &atts); + pthread_mutexattr_destroy(&atts); } /* @@ -104,6 +109,7 @@ public: #else pthread_mutexattr_t atts; pthread_mutexattr_init(&atts); + pthread_mutexattr_setprotocol(&atts, PTHREAD_PRIO_INHERIT); pthread_mutexattr_settype(&atts, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&fMutex, &atts); pthread_mutexattr_destroy(&atts);