[RFC PATCH gnumach 1/3] don't set max_priority in thread template

[email protected]
Newsgroups gmane.os.hurd.bugs
Message-ID <dc4027d9b412987ab7eab4b97fc5940b21598bf6.1777244313.git.dnietoc@gmail.com>
From: Diego Nieto Cid <[email protected]>

Leave max_priority uninitialized (0) so that when
a thread is created it inherits the max priority
from the processor set.

This should not change any behaviour (except allowing
inheritance) because the default max_priority of a
processor set is also BASEPRI_USER.
---
 kern/thread.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kern/thread.c b/kern/thread.c
index deb9688d..0e753d7a 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -335,7 +335,14 @@ void thread_init(void)
 	thread_template.swap_func = thread_bootstrap_return;
 
 /*	thread_template.priority (later) */
-	thread_template.max_priority = BASEPRI_USER;
+	/*
+	 *	Setting a max_priority here prevents inheritance
+	 *	from higher priority tasks to its threads.
+	 *
+	 *	BASEPRI_USER will be set nonetheless as it's the
+	 *	default value of the task processor set.
+	 */
+	thread_template.max_priority = 0;
 /*	thread_template.sched_pri (later - compute_priority) */
 #if	MACH_FIXPRI
 	thread_template.sched_data = 0;
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.