Merge 'task1/priority-donation' into 'master' #14

Merged
sb3923 merged 66 commits from task1/priority-donation into master 2024-10-23 16:15:45 +00:00
4 changed files with 270 additions and 16 deletions
Showing only changes of commit f9d82c92de - Show all commits

View File

@@ -417,6 +417,8 @@ void
thread_recalculate_priority (void) thread_recalculate_priority (void)
{ {
struct thread *t = thread_current (); struct thread *t = thread_current ();
enum intr_level old_level = intr_disable ();
t->priority = t->base_priority; t->priority = t->base_priority;
/* If there are no donors to the current thread, then the effective /* 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) if (max_donated_priority > t->priority)
t->priority = max_donated_priority; t->priority = max_donated_priority;
} }
intr_set_level (old_level);
} }
/* Sets the current thread's nice value to NICE. */ /* Sets the current thread's nice value to NICE. */