diff options
author | Tom <tomut@yahoo.com> | 2020-09-27 08:53:35 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-27 19:46:04 +0200 |
commit | 838d9fa251ed34289cb9c77eb46f889dc9e79416 (patch) | |
tree | 0efecf56806d2fff7ebfbe5b28288a8ac01c5600 /Kernel/Tasks/FinalizerTask.cpp | |
parent | 079486ed7eba3d15567bb5ee9677c81dd190cffa (diff) | |
download | serenity-838d9fa251ed34289cb9c77eb46f889dc9e79416.zip |
Kernel: Make Thread refcounted
Similar to Process, we need to make Thread refcounted. This will solve
problems that will appear once we schedule threads on more than one
processor. This allows us to hold onto threads without necessarily
holding the scheduler lock for the entire duration.
Diffstat (limited to 'Kernel/Tasks/FinalizerTask.cpp')
-rw-r--r-- | Kernel/Tasks/FinalizerTask.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Kernel/Tasks/FinalizerTask.cpp b/Kernel/Tasks/FinalizerTask.cpp index c591a2bc84..fe82f84ab9 100644 --- a/Kernel/Tasks/FinalizerTask.cpp +++ b/Kernel/Tasks/FinalizerTask.cpp @@ -31,7 +31,8 @@ namespace Kernel { void FinalizerTask::spawn() { - Process::create_kernel_process(g_finalizer, "FinalizerTask", [] { + RefPtr<Thread> finalizer_thread; + Process::create_kernel_process(finalizer_thread, "FinalizerTask", [] { Thread::current()->set_priority(THREAD_PRIORITY_LOW); for (;;) { Thread::current()->wait_on(*g_finalizer_wait_queue, "FinalizerTask"); @@ -41,6 +42,7 @@ void FinalizerTask::spawn() Thread::finalize_dying_threads(); } }); + g_finalizer = finalizer_thread; } } |