From: Ben Pfaff Date: Sun, 29 Aug 2004 07:09:17 +0000 (+0000) Subject: Adjust rules for the interrupt level during scheduling. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a224fbc45a3f861d73d6274b0eb5651385128f54;p=pintos-anon Adjust rules for the interrupt level during scheduling. --- diff --git a/src/threads/thread.c b/src/threads/thread.c index dd98be0..5e8a329 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -189,17 +189,17 @@ schedule_tail (struct thread *prev) { struct thread *cur = thread_current (); + ASSERT (intr_get_level () == IF_OFF); + #ifdef USERPROG addrspace_activate (&cur->addrspace); #endif if (prev != NULL && prev->status == THREAD_DYING) thread_destroy (prev); - - intr_enable (); } -void +static void thread_schedule (void) { struct thread *cur, *next, *prev; @@ -228,11 +228,14 @@ thread_schedule (void) void thread_yield (void) { + enum if_level old_level; + ASSERT (!intr_context ()); - intr_disable (); + old_level = intr_disable (); thread_ready (thread_current ()); thread_schedule (); + intr_set_level (old_level); } void