diff --git a/src/threads/thread.c b/src/threads/thread.c index 4ddee22..0a66d65 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -263,7 +263,10 @@ thread_unblock (struct thread *t) old_level = intr_disable (); 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; intr_set_level (old_level); }