Commit fde3a27d authored by David Reid's avatar David Reid

Add support for customizing pthread priorities at compile time.

Use the MA_PTHREAD_REALTTIME_THREAD_PRIORITY define.
parent 766a155f
...@@ -16147,15 +16147,24 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority ...@@ -16147,15 +16147,24 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
if (priority == ma_thread_priority_idle) { if (priority == ma_thread_priority_idle) {
sched.sched_priority = priorityMin; sched.sched_priority = priorityMin;
} else if (priority == ma_thread_priority_realtime) { } else if (priority == ma_thread_priority_realtime) {
sched.sched_priority = priorityMax; #if defined(MA_PTHREAD_REALTTIME_THREAD_PRIORITY)
} else { {
sched.sched_priority += ((int)priority + 5) * priorityStep; /* +5 because the lowest priority is -5. */ sched.sched_priority = MA_PTHREAD_REALTTIME_THREAD_PRIORITY;
if (sched.sched_priority < priorityMin) {
sched.sched_priority = priorityMin;
} }
if (sched.sched_priority > priorityMax) { #else
{
sched.sched_priority = priorityMax; sched.sched_priority = priorityMax;
} }
#endif
} else {
sched.sched_priority += ((int)priority + 5) * priorityStep; /* +5 because the lowest priority is -5. */
}
if (sched.sched_priority < priorityMin) {
sched.sched_priority = priorityMin;
}
if (sched.sched_priority > priorityMax) {
sched.sched_priority = priorityMax;
} }
/* I'm not treating a failure of setting the priority as a critical error so not aborting on failure here. */ /* I'm not treating a failure of setting the priority as a critical error so not aborting on failure here. */
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