31 lines
979 B
Diff
31 lines
979 B
Diff
|
From df72c4d301123c0ea0c33af4bc9d00c47255a664 Mon Sep 17 00:00:00 2001
|
||
|
From: Torge Matthies <openglfreak@googlemail.com>
|
||
|
Date: Thu, 26 Jan 2023 22:13:55 +0100
|
||
|
Subject: [PATCH 3/3] server: Map THREAD_PRIORITY_IDLE to SCHED_IDLE.
|
||
|
|
||
|
---
|
||
|
server/thread.c | 12 ++++++++++++
|
||
|
1 file changed, 12 insertions(+)
|
||
|
|
||
|
--- a/server/thread.c
|
||
|
+++ b/server/thread.c
|
||
|
@@ -858,6 +858,18 @@
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
+#ifdef HAVE_SCHED_SETSCHEDULER
|
||
|
+ if (priority == THREAD_PRIORITY_IDLE)
|
||
|
+ {
|
||
|
+ struct sched_param param;
|
||
|
+ if (sched_getparam( thread->unix_tid, ¶m ) == 0)
|
||
|
+ {
|
||
|
+ param.sched_priority = 0;
|
||
|
+ if (sched_setscheduler( thread->unix_tid, SCHED_IDLE|SCHED_RESET_ON_FORK, ¶m ) == 0)
|
||
|
+ return 0;
|
||
|
+ }
|
||
|
+ }
|
||
|
+#endif
|
||
|
#ifdef HAVE_SETPRIORITY
|
||
|
if (setpriority( PRIO_PROCESS, thread->unix_tid,
|
||
|
get_unix_priority( priority_class, priority ) ) == 0)
|