diff --git a/src/threads/thread.c b/src/threads/thread.c index 6c1dcca..3a428f1 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -357,8 +357,11 @@ void thread_set_priority (int new_priority) { ASSERT (PRI_MIN <= new_priority && new_priority <= PRI_MAX); + int old_priority = thread_get_priority (); + thread_current ()->priority = new_priority; - thread_yield (); + if (new_priority < old_priority) + thread_yield (); } /* Returns the current thread's priority. */