From 81309dcda927ca16e4b49424229d19af013ec8fd Mon Sep 17 00:00:00 2001 From: sBubshait Date: Fri, 25 Oct 2024 15:44:56 +0100 Subject: [PATCH] Refactor sema_up to follow PintOS styling of if statements --- src/threads/synch.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/threads/synch.c b/src/threads/synch.c index f8e6dd3..4933a58 100644 --- a/src/threads/synch.c +++ b/src/threads/synch.c @@ -114,13 +114,13 @@ sema_up (struct semaphore *sema) old_level = intr_disable (); if (!list_empty (&sema->waiters)) - { - /* Enforces wake-up of the highest priority thread waiting for the - semaphore. */ - struct list_elem *e = list_min (&sema->waiters, priority_more, NULL); - list_remove (e); - thread_unblock (list_entry (e, struct thread, elem)); - } + { + /* Enforces wake-up of the highest priority thread waiting for the + semaphore. */ + struct list_elem *e = list_min (&sema->waiters, priority_more, NULL); + list_remove (e); + thread_unblock (list_entry (e, struct thread, elem)); + } sema->value++; intr_set_level (old_level);