mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
Kernel: VERIFY that Scheduler::context_switch() always has a from-thread
We always context_switch() from somewhere, so there's no need to handle the case where from_thread is null.
This commit is contained in:
parent
09f0843716
commit
684d5eed19
Notes:
sideshowbarker
2024-07-17 19:59:45 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/684d5eed193
1 changed files with 10 additions and 10 deletions
|
@ -276,23 +276,23 @@ bool Scheduler::context_switch(Thread* thread)
|
|||
thread->did_schedule();
|
||||
|
||||
auto* from_thread = Thread::current();
|
||||
VERIFY(from_thread);
|
||||
|
||||
if (from_thread == thread)
|
||||
return false;
|
||||
|
||||
if (from_thread) {
|
||||
// If the last process hasn't blocked (still marked as running),
|
||||
// mark it as runnable for the next round.
|
||||
if (from_thread->state() == Thread::State::Running)
|
||||
from_thread->set_state(Thread::State::Runnable);
|
||||
// If the last process hasn't blocked (still marked as running),
|
||||
// mark it as runnable for the next round.
|
||||
if (from_thread->state() == Thread::State::Running)
|
||||
from_thread->set_state(Thread::State::Runnable);
|
||||
|
||||
#ifdef LOG_EVERY_CONTEXT_SWITCH
|
||||
const auto msg = "Scheduler[{}]: {} -> {} [prio={}] {:#04x}:{:p}";
|
||||
const auto msg = "Scheduler[{}]: {} -> {} [prio={}] {:#04x}:{:p}";
|
||||
|
||||
dbgln(msg,
|
||||
Processor::current_id(), from_thread->tid().value(),
|
||||
thread->tid().value(), thread->priority(), thread->regs().cs, thread->regs().ip());
|
||||
dbgln(msg,
|
||||
Processor::current_id(), from_thread->tid().value(),
|
||||
thread->tid().value(), thread->priority(), thread->regs().cs, thread->regs().ip());
|
||||
#endif
|
||||
}
|
||||
|
||||
auto& proc = Processor::current();
|
||||
if (!thread->is_initialized()) {
|
||||
|
|
Loading…
Reference in a new issue