Update thread_yield to add thread back in sorted order of priority
This commit is contained in:
@@ -336,8 +336,11 @@ thread_yield (void)
|
||||
ASSERT (!intr_context ());
|
||||
|
||||
old_level = intr_disable ();
|
||||
|
||||
/* Insert the thread back into the ready list in priority order. */
|
||||
if (cur != idle_thread)
|
||||
list_push_back (&ready_list, &cur->elem);
|
||||
list_insert_ordered(&ready_list, &cur->elem, priority_more, NULL);
|
||||
|
||||
cur->status = THREAD_READY;
|
||||
schedule ();
|
||||
intr_set_level (old_level);
|
||||
|
||||
Reference in New Issue
Block a user