Update sema_down to insert into waiters list in priority sorted order
This commit is contained in:
@@ -68,7 +68,8 @@ sema_down (struct semaphore *sema)
|
||||
old_level = intr_disable ();
|
||||
while (sema->value == 0)
|
||||
{
|
||||
list_push_back (&sema->waiters, &thread_current ()->elem);
|
||||
list_insert_ordered(&sema->waiters, &thread_current ()->elem,
|
||||
priority_more, NULL);
|
||||
thread_block ();
|
||||
}
|
||||
sema->value--;
|
||||
|
||||
Reference in New Issue
Block a user