Update thread_recalculate_priority to disable interrupts preventing race conditions for access to donors and priorities w/ S
This commit is contained in:
@@ -417,6 +417,8 @@ void
|
||||
thread_recalculate_priority (void)
|
||||
{
|
||||
struct thread *t = thread_current ();
|
||||
|
||||
enum intr_level old_level = intr_disable ();
|
||||
t->priority = t->base_priority;
|
||||
|
||||
/* If there are no donors to the current thread, then the effective
|
||||
@@ -432,6 +434,7 @@ thread_recalculate_priority (void)
|
||||
if (max_donated_priority > t->priority)
|
||||
t->priority = max_donated_priority;
|
||||
}
|
||||
intr_set_level (old_level);
|
||||
}
|
||||
|
||||
/* Sets the current thread's nice value to NICE. */
|
||||
|
||||
Reference in New Issue
Block a user