mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
use priority inheritance on mutexes where applicable
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1837 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
61b90a0951
commit
2741685d3a
10 changed files with 48 additions and 15 deletions
|
|
@ -40,15 +40,20 @@ struct pa_cond {
|
|||
pthread_cond_t cond;
|
||||
};
|
||||
|
||||
pa_mutex* pa_mutex_new(int recursive) {
|
||||
pa_mutex* pa_mutex_new(pa_bool_t recursive, pa_bool_t inherit_priority) {
|
||||
pa_mutex *m;
|
||||
pthread_mutexattr_t attr;
|
||||
|
||||
pthread_mutexattr_init(&attr);
|
||||
|
||||
|
||||
if (recursive)
|
||||
pa_assert_se(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) == 0);
|
||||
|
||||
#ifdef HAVE_PTHREAD_PRIO_INHERIT
|
||||
if (inherit_priority)
|
||||
pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT);
|
||||
#endif
|
||||
|
||||
m = pa_xnew(pa_mutex, 1);
|
||||
pa_assert_se(pthread_mutex_init(&m->mutex, &attr) == 0);
|
||||
return m;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue