Commit 44e58d60 authored by David Reid's avatar David Reid

Fix some bugs with initialization of POSIX threads.

parent d28c1ebe
...@@ -2,6 +2,7 @@ v0.11.12 - TBD ...@@ -2,6 +2,7 @@ v0.11.12 - TBD
===================== =====================
* Fix a crash due to a race condition in the resource manager. * Fix a crash due to a race condition in the resource manager.
* Fix a crash with some backends when rerouting the playback side of a duplex device. * Fix a crash with some backends when rerouting the playback side of a duplex device.
* Fix some bugs with initialization of POSIX threads.
v0.11.11 - 2022-11-04 v0.11.11 - 2022-11-04
......
...@@ -15852,6 +15852,10 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority ...@@ -15852,6 +15852,10 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
pthread_attr_t attr; pthread_attr_t attr;
if (pthread_attr_init(&attr) == 0) { if (pthread_attr_init(&attr) == 0) {
int scheduler = -1; int scheduler = -1;
/* We successfully initialized our attributes object so we can assign the pointer so it's passed into pthread_create(). */
pAttr = &attr;
if (priority == ma_thread_priority_idle) { if (priority == ma_thread_priority_idle) {
#ifdef SCHED_IDLE #ifdef SCHED_IDLE
if (pthread_attr_setschedpolicy(&attr, SCHED_IDLE) == 0) { if (pthread_attr_setschedpolicy(&attr, SCHED_IDLE) == 0) {
...@@ -15895,9 +15899,8 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority ...@@ -15895,9 +15899,8 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
} }
} }
if (pthread_attr_setschedparam(&attr, &sched) == 0) { /* I'm not treating a failure of setting the priority as a critical error so not checking the return value here. */
pAttr = &attr; pthread_attr_setschedparam(&attr, &sched);
}
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment