mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +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
1 changed files with 10 additions and 10 deletions
|
@ -276,10 +276,11 @@ bool Scheduler::context_switch(Thread* thread)
|
||||||
thread->did_schedule();
|
thread->did_schedule();
|
||||||
|
|
||||||
auto* from_thread = Thread::current();
|
auto* from_thread = Thread::current();
|
||||||
|
VERIFY(from_thread);
|
||||||
|
|
||||||
if (from_thread == thread)
|
if (from_thread == thread)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (from_thread) {
|
|
||||||
// If the last process hasn't blocked (still marked as running),
|
// If the last process hasn't blocked (still marked as running),
|
||||||
// mark it as runnable for the next round.
|
// mark it as runnable for the next round.
|
||||||
if (from_thread->state() == Thread::State::Running)
|
if (from_thread->state() == Thread::State::Running)
|
||||||
|
@ -292,7 +293,6 @@ bool Scheduler::context_switch(Thread* thread)
|
||||||
Processor::current_id(), from_thread->tid().value(),
|
Processor::current_id(), from_thread->tid().value(),
|
||||||
thread->tid().value(), thread->priority(), thread->regs().cs, thread->regs().ip());
|
thread->tid().value(), thread->priority(), thread->regs().cs, thread->regs().ip());
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
auto& proc = Processor::current();
|
auto& proc = Processor::current();
|
||||||
if (!thread->is_initialized()) {
|
if (!thread->is_initialized()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue