From cffcfca80a02b408521d9de6dc3a740b4c8ce23e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 30 Jan 2022 14:29:37 +0100 Subject: [PATCH] Kernel: Remove unused bool return values from scheduler functions Turns out nobody actually cared whether the scheduler switched to a new thread or not (which is what we were returning.) --- Kernel/Scheduler.cpp | 21 +++++++-------------- Kernel/Scheduler.h | 6 +++--- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 9a27203e9a..94d2c38f9d 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -205,7 +205,7 @@ UNMAP_AFTER_INIT void Scheduler::start() VERIFY_NOT_REACHED(); } -bool Scheduler::pick_next() +void Scheduler::pick_next() { VERIFY_INTERRUPTS_DISABLED(); @@ -241,10 +241,10 @@ bool Scheduler::pick_next() critical.leave(); thread_to_schedule.set_ticks_left(time_slice_for(thread_to_schedule)); - return context_switch(&thread_to_schedule); + context_switch(&thread_to_schedule); } -bool Scheduler::yield() +void Scheduler::yield() { InterruptDisabler disabler; @@ -256,18 +256,13 @@ bool Scheduler::yield() // a critical section where we don't want to switch contexts, then // delay until exiting the trap or critical section Processor::current().invoke_scheduler_async(); - return false; + return; } - if (!Scheduler::pick_next()) - return false; - - if constexpr (SCHEDULER_DEBUG) - dbgln("Scheduler[{}]: yield returns to thread {} in_irq={}", Processor::current_id(), *current_thread, Processor::current_in_irq()); - return true; + Scheduler::pick_next(); } -bool Scheduler::context_switch(Thread* thread) +void Scheduler::context_switch(Thread* thread) { if (Memory::s_mm_lock.is_locked_by_current_processor()) { PANIC("In context switch while holding Memory::s_mm_lock"); @@ -279,7 +274,7 @@ bool Scheduler::context_switch(Thread* thread) VERIFY(from_thread); if (from_thread == thread) - return false; + return; // If the last process hasn't blocked (still marked as running), // mark it as runnable for the next round. @@ -309,8 +304,6 @@ bool Scheduler::context_switch(Thread* thread) // switched from, and thread reflects Thread::current() enter_current(*from_thread); VERIFY(thread == Thread::current()); - - return true; } void Scheduler::enter_current(Thread& prev_thread) diff --git a/Kernel/Scheduler.h b/Kernel/Scheduler.h index a6b623a5c3..1cff99c019 100644 --- a/Kernel/Scheduler.h +++ b/Kernel/Scheduler.h @@ -36,9 +36,9 @@ public: static void set_idle_thread(Thread* idle_thread); static void timer_tick(const RegisterState&); [[noreturn]] static void start(); - static bool pick_next(); - static bool yield(); - static bool context_switch(Thread*); + static void pick_next(); + static void yield(); + static void context_switch(Thread*); static void enter_current(Thread& prev_thread); static void leave_on_first_switch(u32 flags); static void prepare_after_exec();