From 9f53040d27a33168c2bc43f61a1e5b59253de9f3 Mon Sep 17 00:00:00 2001 From: sBubshait Date: Thu, 17 Oct 2024 06:00:34 +0100 Subject: [PATCH] Update thread_set_priority to not do anything if priority is unchanged --- src/threads/thread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/threads/thread.c b/src/threads/thread.c index e34d23e..f681f92 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -383,6 +383,10 @@ thread_set_priority (int new_priority) ASSERT (new_priority >= PRI_MIN); ASSERT (new_priority <= PRI_MAX); + int old_priority = thread_get_priority (); + if (new_priority == old_priority) + return; + thread_current ()->priority = new_priority; }