From b82bd44f0327c6853f466fad27edc3d4707aea73 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 16 Sep 2004 21:11:40 +0000 Subject: [PATCH] Make thread_unblock() on a thread that isn't blocked an error. --- src/threads/thread.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/threads/thread.c b/src/threads/thread.c index 5400f78..90a4dcd 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -183,7 +183,7 @@ thread_execute (const char *filename) #endif /* Transitions a blocked thread T from its current state to the - ready-to-run state. If T is not blocked, there is no effect. + ready-to-run state. This is an error if T is not blocked. (Use thread_yield() to make the running thread ready.) */ void thread_unblock (struct thread *t) @@ -193,11 +193,9 @@ thread_unblock (struct thread *t) ASSERT (is_thread (t)); old_level = intr_disable (); - if (t->status == THREAD_BLOCKED) - { - list_push_back (&ready_list, &t->elem); - t->status = THREAD_READY; - } + ASSERT (t->status == THREAD_BLOCKED); + list_push_back (&ready_list, &t->elem); + t->status = THREAD_READY; intr_set_level (old_level); } -- 2.30.2