From ea06d6100e3f1aa8bf18f79463f47c1ee5ee586d Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 26 Nov 2023 12:12:43 +0100 Subject: [PATCH] Fix Linux thread priority Signed-off-by: falkTX --- modules/juce_core/native/juce_posix_SharedCode.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index 13724ba7c7..f8892081cf 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -989,7 +989,11 @@ bool Thread::setThreadPriority (void* handle, int priority) if (pthread_getschedparam ((pthread_t) handle, &policy, ¶m) != 0) return false; + #if JUCE_LINUX + policy = priority < 9 ? SCHED_OTHER : SCHED_RR; + #else policy = priority == 0 ? SCHED_OTHER : SCHED_RR; + #endif const int minPriority = sched_get_priority_min (policy); const int maxPriority = sched_get_priority_max (policy);