From 95386971e2dd07bd20ee1280d47e85a8c85eccfa Mon Sep 17 00:00:00 2001 From: Themis Demetriades Date: Wed, 23 Oct 2024 16:45:42 +0100 Subject: [PATCH] Update lock_release to disable interrupts in critical sections w/ S --- src/threads/synch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/threads/synch.c b/src/threads/synch.c index 940faa5..1246206 100644 --- a/src/threads/synch.c +++ b/src/threads/synch.c @@ -303,6 +303,7 @@ lock_release (struct lock *lock) struct list orphan_list; list_init (&orphan_list); + enum intr_level old_level = intr_disable (); /* Loop through current thread's donors, removing the ones waiting for the lock being released and keeping track of them (within orphan_list). Also identifies the highest priority donor thread among them. */ @@ -336,6 +337,7 @@ lock_release (struct lock *lock) list_push_back (&max_donor->donors_list, list_pop_front (&orphan_list)); } + intr_set_level (old_level); /* Removal of donors to this thread may change its effective priority, so recalculate. */ thread_recalculate_priority ();