From bf6104200ce5539d34257c9b74fe7c7982fd63aa Mon Sep 17 00:00:00 2001 From: sBubshait Date: Tue, 22 Oct 2024 20:47:34 +0100 Subject: [PATCH] Refactor thread set priority to remove unused variable and add comment, w/ T --- src/threads/thread.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/threads/thread.c b/src/threads/thread.c index 1cf40af..79dd339 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -395,9 +395,8 @@ thread_set_priority (int new_base_priority) struct thread *t = thread_current (); - int old_base_priority = t->base_priority; - int old_priority = thread_get_priority (); - if (new_base_priority == old_base_priority) + /* If the base priority is unchanged, do nothing. */ + if (new_base_priority == t->base_priority) return; t->base_priority = new_base_priority;