Update thread_unblock to maintain priority order in ready_list

This commit is contained in:
sBubshait
2024-10-16 08:00:50 +01:00
parent 1c53790ca7
commit fda79173c0

View File

@@ -263,7 +263,10 @@ thread_unblock (struct thread *t)
old_level = intr_disable (); old_level = intr_disable ();
ASSERT (t->status == THREAD_BLOCKED); ASSERT (t->status == THREAD_BLOCKED);
list_push_back (&ready_list, &t->elem);
/* Insert the thread back into the ready list in priority order. */
list_insert_ordered(&ready_list, &t->elem, priority_more, NULL);
t->status = THREAD_READY; t->status = THREAD_READY;
intr_set_level (old_level); intr_set_level (old_level);
} }