From 7054e588149884c5c408997cb4d5c751ee8c23a4 Mon Sep 17 00:00:00 2001 From: Philippe Aubertin Date: Thu, 21 Nov 2024 16:48:51 -0500 Subject: [PATCH] credits -> cpu_credits --- include/kernel/types.h | 2 +- kernel/domain/entities/thread.c | 2 +- kernel/domain/services/scheduler.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/kernel/types.h b/include/kernel/types.h index e3cfe4f1..14071b39 100644 --- a/include/kernel/types.h +++ b/include/kernel/types.h @@ -109,7 +109,7 @@ struct thread_t { machine_thread_t machine_thread; list_node_t thread_list; thread_state_t state; - int credits; + int cpu_credits; process_t *process; struct thread_t *sender; struct thread_t *awaiter; diff --git a/kernel/domain/entities/thread.c b/kernel/domain/entities/thread.c index ab75d514..a62ec32d 100644 --- a/kernel/domain/entities/thread.c +++ b/kernel/domain/entities/thread.c @@ -129,7 +129,7 @@ void thread_prepare(thread_t *thread, const thread_params_t *params) { thread->awaiter = NULL; thread->state = THREAD_STATE_STARTING; - thread->credits = 0; + thread->cpu_credits = 0; spin_unlock(&thread->await_lock); diff --git a/kernel/domain/services/scheduler.c b/kernel/domain/services/scheduler.c index d9b3f54b..a687eb46 100644 --- a/kernel/domain/services/scheduler.c +++ b/kernel/domain/services/scheduler.c @@ -83,7 +83,7 @@ static thread_t *select_next_ready_thread(bool current_can_run) { panic("No thread to schedule"); } - to->credits += SCHEDULER_BASE_CREDITS; + to->cpu_credits += SCHEDULER_BASE_CREDITS; return to; } @@ -108,7 +108,7 @@ static void thread_ready_locked(thread_t *thread) { void reschedule(void) { thread_t *current = get_current_thread(); - if(current->credits > 0) { + if(current->cpu_credits > 0) { return; } @@ -134,8 +134,8 @@ void reschedule(void) { void scheduler_tick(void) { thread_t *current = get_current_thread(); - if(current->credits > 0) { - --current->credits; + if(current->cpu_credits > 0) { + --current->cpu_credits; } } @@ -163,7 +163,7 @@ void yield_current_thread(void) { /* This defers the thread switch to the next time reschedule() is called, * which will happen at the end of the system call. */ thread_t *current = get_current_thread(); - current->credits = 0; + current->cpu_credits = 0; } /**