From e38e1400a2cbd12227a6edd36a8b98592ccce4e6 Mon Sep 17 00:00:00 2001 From: Themis Demetriades Date: Thu, 17 Oct 2024 09:19:09 +0100 Subject: [PATCH] Update singleton_sema_priority_greater function description for clarity --- src/threads/synch.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/threads/synch.c b/src/threads/synch.c index 0cb9989..12fdf11 100644 --- a/src/threads/synch.c +++ b/src/threads/synch.c @@ -270,8 +270,11 @@ cond_init (struct condition *cond) semaphore is greater than the priority of the only thread in the second singleton semaphore. - If used for insertion, the third argument must be a pointer to struct - list_elem for the thread being inserted, otherwise must be NULL. */ + Where this function is used for insertion in a singleton semaphore list, the + third argument may specify a list_elem * to assume corresponds to the thread + waiting for the inserting semaphore. For correctness, ensure this thread + calls sema_down () for this semaphore before future list accesses. */ + static bool singleton_sema_priority_greater (const struct list_elem *a, const struct list_elem *b,