Browse Source

Mutex: Use PTHREAD_PRIO_INHERIT protocol

pull/6/head
falkTX 8 years ago
parent
commit
fd34de63e4
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      distrho/extra/Mutex.hpp

+ 7
- 1
distrho/extra/Mutex.hpp View File

@@ -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);


Loading…
Cancel
Save