mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 12:18:25 +00:00
Kernel: Implement software context switching and Processor structure
Moving certain globals into a new Processor structure for each CPU allows us to eventually run an instance of the scheduler on each CPU.
This commit is contained in:
@@ -34,14 +34,12 @@ void FinalizerTask::spawn()
|
||||
Process::create_kernel_process(g_finalizer, "FinalizerTask", [] {
|
||||
Thread::current->set_priority(THREAD_PRIORITY_LOW);
|
||||
for (;;) {
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
if (!g_finalizer_has_work)
|
||||
Thread::current->wait_on(*g_finalizer_wait_queue);
|
||||
ASSERT(g_finalizer_has_work);
|
||||
g_finalizer_has_work = false;
|
||||
}
|
||||
Thread::finalize_dying_threads();
|
||||
dbg() << "Finalizer task is running";
|
||||
Thread::current->wait_on(*g_finalizer_wait_queue);
|
||||
|
||||
bool expected = true;
|
||||
if (g_finalizer_has_work.compare_exchange_strong(expected, false, AK::MemoryOrder::memory_order_acq_rel))
|
||||
Thread::finalize_dying_threads();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user