diff options
author | Tom <tomut@yahoo.com> | 2020-11-16 20:51:34 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-30 13:17:02 +0100 |
commit | 6a620562cc7298c2f591a06817ff560c9ef1deac (patch) | |
tree | f163becbd40b4b4cf7058ca2ea191dec7335f1ed /Kernel/Scheduler.cpp | |
parent | 6cb640eebaf40acbd505bcfdb0dee8e99fb77223 (diff) | |
download | serenity-6a620562cc7298c2f591a06817ff560c9ef1deac.zip |
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.
Diffstat (limited to 'Kernel/Scheduler.cpp')
-rw-r--r-- | Kernel/Scheduler.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 8f4ad69602..e89bd89f77 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -754,7 +754,7 @@ void Scheduler::initialize() g_finalizer_wait_queue = new WaitQueue; g_finalizer_has_work.store(false, AK::MemoryOrder::memory_order_release); - s_colonel_process = &Process::create_kernel_process(idle_thread, "colonel", idle_loop, 1).leak_ref(); + s_colonel_process = &Process::create_kernel_process(idle_thread, "colonel", idle_loop, nullptr, 1).leak_ref(); ASSERT(s_colonel_process); ASSERT(idle_thread); idle_thread->set_priority(THREAD_PRIORITY_MIN); @@ -776,7 +776,7 @@ Thread* Scheduler::create_ap_idle_thread(u32 cpu) ASSERT(Processor::current().id() == 0); ASSERT(s_colonel_process); - Thread* idle_thread = s_colonel_process->create_kernel_thread(idle_loop, THREAD_PRIORITY_MIN, String::format("idle thread #%u", cpu), 1 << cpu, false); + Thread* idle_thread = s_colonel_process->create_kernel_thread(idle_loop, nullptr, THREAD_PRIORITY_MIN, String::format("idle thread #%u", cpu), 1 << cpu, false); ASSERT(idle_thread); return idle_thread; } @@ -832,7 +832,7 @@ void Scheduler::notify_finalizer() g_finalizer_wait_queue->wake_all(); } -void Scheduler::idle_loop() +void Scheduler::idle_loop(void*) { dbg() << "Scheduler[" << Processor::current().id() << "]: idle loop running"; ASSERT(are_interrupts_enabled()); |