From 5921be95d3bfcf239436681bc5fe7837c5cee203 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 16 Jul 2024 15:20:57 +0300 Subject: [PATCH] utils: Fix gaining realtime scheduling with musl sched_setscheduler() is implemented as a stub in musl that does nothing because Linux provides no way to set scheduling parameters per process. Use pthread_setschedparam() to change the scheduling parameters of the threads instead. BUG: 487996 --- src/utils/realtime.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/realtime.cpp b/src/utils/realtime.cpp index aff3d5077f..aeb2a2dbfe 100644 --- a/src/utils/realtime.cpp +++ b/src/utils/realtime.cpp @@ -8,6 +8,7 @@ #include "config-kwin.h" +#include #include namespace KWin @@ -19,7 +20,7 @@ void gainRealTime() const int minPriority = sched_get_priority_min(SCHED_RR); sched_param sp; sp.sched_priority = minPriority; - sched_setscheduler(0, SCHED_RR | SCHED_RESET_ON_FORK, &sp); + pthread_setschedparam(pthread_self(), SCHED_RR | SCHED_RESET_ON_FORK, &sp); #endif }