From 44de31c0ff26b83d88369e4005e79e8e7e717b7c Mon Sep 17 00:00:00 2001 From: sBubshait Date: Sun, 20 Oct 2024 20:54:48 +0100 Subject: [PATCH] Fix Bug in Implementation of recalculate priority setting base priority, w/ T --- src/threads/thread.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/threads/thread.c b/src/threads/thread.c index d85e05a..b626a96 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -386,10 +386,7 @@ thread_set_priority (int new_base_priority) return; t->base_priority = new_base_priority; - t->priority = new_base_priority; - - if (new_base_priority < old_priority) - thread_recalculate_priority (); + thread_recalculate_priority (); thread_yield (); } @@ -406,6 +403,7 @@ void thread_recalculate_priority (void) { struct thread *t = thread_current (); + t->priority = t->base_priority; if (!list_empty (&t->donors_list)) { int max_donated_priority =