Update thread_unblock to maintain priority order in ready_list
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user