mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 04:08:08 +00:00
Kernel: Fix Thread::relock_process leaving critical section
We don't want to explicitly enable interrupts when leaving the critical section to trigger a context switch.
This commit is contained in:
@@ -583,16 +583,19 @@ void Scheduler::invoke_async()
|
||||
void Scheduler::yield_from_critical()
|
||||
{
|
||||
auto& proc = Processor::current();
|
||||
ASSERT(proc.in_critical());
|
||||
auto before_critical = proc.in_critical();
|
||||
ASSERT(before_critical);
|
||||
ASSERT(!proc.in_irq());
|
||||
|
||||
yield(); // Flag a context switch
|
||||
|
||||
u32 prev_flags;
|
||||
u32 prev_crit = Processor::current().clear_critical(prev_flags, false);
|
||||
u32 prev_crit = proc.clear_critical(prev_flags, false);
|
||||
|
||||
// Note, we may now be on a different CPU!
|
||||
Processor::current().restore_critical(prev_crit, prev_flags);
|
||||
auto& new_proc = Processor::current();
|
||||
new_proc.restore_critical(prev_crit, prev_flags);
|
||||
ASSERT(before_critical == new_proc.in_critical());
|
||||
}
|
||||
|
||||
void Scheduler::notify_finalizer()
|
||||
|
||||
Reference in New Issue
Block a user