bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/5 gnumach] sched_prim.c: Lock thread when calling thread_setrun


From: Damien Zammit
Subject: [PATCH 4/5 gnumach] sched_prim.c: Lock thread when calling thread_setrun
Date: Wed, 16 Aug 2023 01:49:24 +0000

---
 kern/sched_prim.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index 5def77d4..bc7befe8 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -1793,7 +1793,9 @@ retry:
                         */
                        if ((new_thread = (thread_t)*threadp)!= THREAD_NULL) {
                                *threadp = (volatile thread_t) THREAD_NULL;
+                               thread_lock(new_thread);
                                thread_setrun(new_thread, FALSE);
+                               thread_unlock(new_thread);
                        }
 
                        counter(c_idle_thread_block++);
-- 
2.40.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]