Update setting of priority of threads to only yield when current thread's priority has been lowered

This commit is contained in:
Themis Demetriades
2024-10-15 15:38:31 +01:00
parent 3c1a26b668
commit 163b7f9016

View File

@@ -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. */