Update thread module to maintain list of ready threads in descending order of priority
This commit is contained in:
@@ -256,7 +256,7 @@ thread_unblock (struct thread *t)
|
||||
|
||||
old_level = intr_disable ();
|
||||
ASSERT (t->status == THREAD_BLOCKED);
|
||||
list_push_back (&ready_list, &t->elem);
|
||||
list_insert_ordered (&ready_list, &t->elem, &thread_priority_greater, NULL);
|
||||
t->status = THREAD_READY;
|
||||
intr_set_level (old_level);
|
||||
}
|
||||
@@ -327,7 +327,8 @@ thread_yield (void)
|
||||
|
||||
old_level = intr_disable ();
|
||||
if (cur != idle_thread)
|
||||
list_push_back (&ready_list, &cur->elem);
|
||||
list_insert_ordered (&ready_list, &cur->elem, thread_priority_greater,
|
||||
NULL);
|
||||
cur->status = THREAD_READY;
|
||||
schedule ();
|
||||
intr_set_level (old_level);
|
||||
|
||||
Reference in New Issue
Block a user