From 48104b3a410862b4a942d6c1e2e089988b52b247 Mon Sep 17 00:00:00 2001 From: Themis Demetriades Date: Tue, 22 Oct 2024 20:57:18 +0100 Subject: [PATCH] Refactor cond_signal to add comment clarifying the logic w/ S --- src/threads/synch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/threads/synch.c b/src/threads/synch.c index 73dceba..655e014 100644 --- a/src/threads/synch.c +++ b/src/threads/synch.c @@ -436,11 +436,12 @@ cond_signal (struct condition *cond, struct lock *lock UNUSED) 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); list_remove (e); sema_up (&list_entry (e, struct semaphore_elem, elem)->semaphore); } - } /* Wakes up all threads, if any, waiting on COND (protected by