From efed660968230394aac17ecba25576681a1b23d4 Mon Sep 17 00:00:00 2001 From: EDiasAlberto Date: Tue, 15 Oct 2024 19:25:02 +0100 Subject: [PATCH] implement thread_set_nice and make skeleton for calculate_priority --- src/threads/thread.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/threads/thread.c b/src/threads/thread.c index 82aa317..c74d86b 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -364,11 +364,20 @@ thread_get_priority (void) return thread_current ()->priority; } +/* Calculates priority for the current thread */ +int +calculate_priority (void) +{ + /* Not yet implemented */ + return 0; +} + /* Sets the current thread's nice value to NICE. */ void -thread_set_nice (int nice UNUSED) +thread_set_nice (int nice) { - /* Not yet implemented. */ + thread_current ()->nice = nice; + calculate_priority (); } /* Returns the current thread's nice value. */