Refactor cond_signal to add comment clarifying the logic w/ S
This commit is contained in:
@@ -436,11 +436,12 @@ cond_signal (struct condition *cond, struct lock *lock UNUSED)
|
|||||||
|
|
||||||
if (!list_empty (&cond->waiters))
|
if (!list_empty (&cond->waiters))
|
||||||
{
|
{
|
||||||
|
/* Enforce wake-up of highest priority thread within the singleton
|
||||||
|
semaphores waiting for condvar. */
|
||||||
struct list_elem *e = list_min (&cond->waiters, sema_priority_more, NULL);
|
struct list_elem *e = list_min (&cond->waiters, sema_priority_more, NULL);
|
||||||
list_remove (e);
|
list_remove (e);
|
||||||
sema_up (&list_entry (e, struct semaphore_elem, elem)->semaphore);
|
sema_up (&list_entry (e, struct semaphore_elem, elem)->semaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wakes up all threads, if any, waiting on COND (protected by
|
/* Wakes up all threads, if any, waiting on COND (protected by
|
||||||
|
|||||||
Reference in New Issue
Block a user