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
3 changed files with 26 additions and 3 deletions
Showing only changes of commit 163b7f9016 - Show all commits

View File

@@ -357,8 +357,11 @@ void
thread_set_priority (int new_priority) thread_set_priority (int new_priority)
{ {
ASSERT (PRI_MIN <= new_priority && new_priority <= PRI_MAX); ASSERT (PRI_MIN <= new_priority && new_priority <= PRI_MAX);
int old_priority = thread_get_priority ();
thread_current ()->priority = new_priority; thread_current ()->priority = new_priority;
thread_yield (); if (new_priority < old_priority)
thread_yield ();
} }
/* Returns the current thread's priority. */ /* Returns the current thread's priority. */