1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:57:44 +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:
Tom 2020-11-16 20:51:34 -07:00 committed by Andreas Kling
parent 6cb640eeba
commit 6a620562cc
11 changed files with 68 additions and 24 deletions

View file

@ -93,11 +93,7 @@ void Process::sys$exit_thread(Userspace<void*> exit_value)
{
REQUIRE_PROMISE(thread);
cli();
auto current_thread = Thread::current();
current_thread->m_exit_value = reinterpret_cast<void*>(exit_value.ptr());
current_thread->set_should_die();
big_lock().force_unlock_if_locked();
current_thread->die_if_needed();
Thread::current()->exit(reinterpret_cast<void*>(exit_value.ptr()));
ASSERT_NOT_REACHED();
}