Update lock_release to disable interrupts in critical sections w/ S
This commit is contained in:
@@ -303,6 +303,7 @@ lock_release (struct lock *lock)
|
|||||||
struct list orphan_list;
|
struct list orphan_list;
|
||||||
list_init (&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
|
/* Loop through current thread's donors, removing the ones waiting for the
|
||||||
lock being released and keeping track of them (within orphan_list).
|
lock being released and keeping track of them (within orphan_list).
|
||||||
Also identifies the highest priority donor thread among them. */
|
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));
|
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,
|
/* Removal of donors to this thread may change its effective priority,
|
||||||
so recalculate. */
|
so recalculate. */
|
||||||
thread_recalculate_priority ();
|
thread_recalculate_priority ();
|
||||||
|
|||||||
Reference in New Issue
Block a user