bug-hurd
[Top][All Lists]
Advanced

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

[PATCH gnumach] Make thread_suspend honor the TH_UNINT flag


From: Sergio López
Subject: [PATCH gnumach] Make thread_suspend honor the TH_UNINT flag
Date: Tue, 27 Sep 2011 15:52:51 +0200

Interrupting a thread without a continuation, puts it in a
inconsistent state. This is the cause for the bug described in
https://lists.gnu.org/archive/html/bug-hurd/2011-09/msg00148.html

* kern/thread.c (thread_suspend): Fail with KERN_FAILURE if thread is
uninterruptible.

---
 kern/thread.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kern/thread.c b/kern/thread.c
index 1548e14..bf2df94 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1329,6 +1329,11 @@ kern_return_t thread_suspend(
        hold = FALSE;
        spl = splsched();
        thread_lock(thread);
+       if (thread->state & TH_UNINT) {
+               thread_unlock(thread);
+               (void) splx(spl);
+               return KERN_FAILURE;
+       }
        if (thread->user_stop_count++ == 0) {
                hold = TRUE;
                thread->suspend_count++;
-- 
1.7.6



reply via email to

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