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
This commit is contained in:
parent
de9eb16527
commit
5921be95d3
1 changed files with 2 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "config-kwin.h"
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue