diff options
Diffstat (limited to 'Kernel/Tasks')
-rw-r--r-- | Kernel/Tasks/FinalizerTask.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/Kernel/Tasks/FinalizerTask.cpp b/Kernel/Tasks/FinalizerTask.cpp index 786b8f5ee8..8679c1fd3f 100644 --- a/Kernel/Tasks/FinalizerTask.cpp +++ b/Kernel/Tasks/FinalizerTask.cpp @@ -9,20 +9,22 @@ namespace Kernel { +static void finalizer_task(void*) +{ + Thread::current()->set_priority(THREAD_PRIORITY_LOW); + for (;;) { + g_finalizer_wait_queue->wait_forever("FinalizerTask"); + + if (g_finalizer_has_work.exchange(false, AK::MemoryOrder::memory_order_acq_rel) == true) + Thread::finalize_dying_threads(); + } +}; + void FinalizerTask::spawn() { RefPtr<Thread> finalizer_thread; - Process::create_kernel_process( - finalizer_thread, "FinalizerTask", [](void*) { - Thread::current()->set_priority(THREAD_PRIORITY_LOW); - for (;;) { - g_finalizer_wait_queue->wait_forever("FinalizerTask"); - - if (g_finalizer_has_work.exchange(false, AK::MemoryOrder::memory_order_acq_rel) == true) - Thread::finalize_dying_threads(); - } - }, - nullptr); + auto finalizer_process = Process::create_kernel_process(finalizer_thread, "FinalizerTask", finalizer_task, nullptr); + VERIFY(finalizer_process); g_finalizer = finalizer_thread; } |