mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
Kernel: Allow passing a thread argument for new kernel threads
This adds the ability to pass a pointer to kernel thread/process. Also add the ability to use a closure as thread function, which allows passing information to a kernel thread more easily.
This commit is contained in:
parent
6cb640eeba
commit
6a620562cc
11 changed files with 68 additions and 24 deletions
|
@ -32,7 +32,7 @@ namespace Kernel {
|
|||
void FinalizerTask::spawn()
|
||||
{
|
||||
RefPtr<Thread> finalizer_thread;
|
||||
Process::create_kernel_process(finalizer_thread, "FinalizerTask", [] {
|
||||
Process::create_kernel_process(finalizer_thread, "FinalizerTask", [](void*) {
|
||||
Thread::current()->set_priority(THREAD_PRIORITY_LOW);
|
||||
for (;;) {
|
||||
Thread::current()->wait_on(*g_finalizer_wait_queue, "FinalizerTask");
|
||||
|
@ -41,7 +41,7 @@ void FinalizerTask::spawn()
|
|||
if (g_finalizer_has_work.compare_exchange_strong(expected, false, AK::MemoryOrder::memory_order_acq_rel))
|
||||
Thread::finalize_dying_threads();
|
||||
}
|
||||
});
|
||||
}, nullptr);
|
||||
g_finalizer = finalizer_thread;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue