Update setting of priority of threads to only yield when current thread's priority has been lowered
This commit is contained in:
@@ -357,7 +357,10 @@ 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;
|
||||||
|
if (new_priority < old_priority)
|
||||||
thread_yield ();
|
thread_yield ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user