From 6a1d10a19b767b0cbb0ff6f5a04118860b2e7597 Mon Sep 17 00:00:00 2001 From: sBubshait Date: Fri, 15 Nov 2024 13:28:55 +0000 Subject: [PATCH] Refactor synch to follow PintOS curly braces indentation style in if statements --- src/threads/synch.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/threads/synch.c b/src/threads/synch.c index 65c5bde..622e015 100644 --- a/src/threads/synch.c +++ b/src/threads/synch.c @@ -119,14 +119,14 @@ 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_max (&sema->waiters, priority_less, NULL); - list_remove (e); - thread_unblock (list_entry (e, struct thread, elem)); - thread_unblocked = true; - } + { + /* Enforces wake-up of the highest priority thread waiting for the + semaphore. */ + struct list_elem *e = list_max (&sema->waiters, priority_less, NULL); + list_remove (e); + thread_unblock (list_entry (e, struct thread, elem)); + thread_unblocked = true; + } sema->value++; intr_set_level (old_level); @@ -134,12 +134,12 @@ sema_up (struct semaphore *sema) priority that the current running thread, including the case when called within an interrupt handler. */ if (thread_unblocked) - { - if (intr_context ()) - intr_yield_on_return (); - else - thread_yield (); - } + { + if (intr_context ()) + intr_yield_on_return (); + else + thread_yield (); + } } static void sema_test_helper (void *sema_);