summaryrefslogtreecommitdiff
path: root/Kernel/Tasks/FinalizerTask.cpp
diff options
context:
space:
mode:
authorAndrew Kaster <andrewdkaster@gmail.com>2021-05-23 13:45:58 -0600
committerAndreas Kling <kling@serenityos.org>2021-05-27 10:21:30 +0200
commit86e30100437b57d6da66207fe860fb167d8278db (patch)
tree5086d184d841388ae74da5429c73090675528a77 /Kernel/Tasks/FinalizerTask.cpp
parent6459c5a713da6fab14a601620c0e1676b5178f98 (diff)
downloadserenity-86e30100437b57d6da66207fe860fb167d8278db.zip
Kernel: Pass trampolines instead of lambdas to create_kernel_process
With -Og, all calls to create_kernel_process were triggering -Wnonnull when creating these lambdas that get implicitly converted to function pointers. A different design of create_kernel_process to use AK::Function instead might avoid this awkward behavior.
Diffstat (limited to 'Kernel/Tasks/FinalizerTask.cpp')
-rw-r--r--Kernel/Tasks/FinalizerTask.cpp24
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;
}