1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 02:28:12 +00:00

Kernel: Make Threads always have a name

We previously allowed Thread to exist in a state where its m_name was
null, and had to work around that in various places.

This patch removes that possibility and forces those who would create a
thread (or change the name of one) to provide a NonnullOwnPtr<KString>
with the name.
This commit is contained in:
Andreas Kling 2021-09-06 12:44:27 +02:00
parent cda2b9e71c
commit 7981422500
7 changed files with 25 additions and 13 deletions

View file

@ -417,7 +417,7 @@ UNMAP_AFTER_INIT void Scheduler::initialize()
VERIFY(s_colonel_process);
VERIFY(idle_thread);
idle_thread->set_priority(THREAD_PRIORITY_MIN);
idle_thread->set_name(KString::try_create("idle thread #0"));
idle_thread->set_name(KString::must_create("idle thread #0"));
set_idle_thread(idle_thread);
}
@ -436,7 +436,7 @@ UNMAP_AFTER_INIT Thread* Scheduler::create_ap_idle_thread(u32 cpu)
VERIFY(Processor::is_bootstrap_processor());
VERIFY(s_colonel_process);
Thread* idle_thread = s_colonel_process->create_kernel_thread(idle_loop, nullptr, THREAD_PRIORITY_MIN, KString::try_create(String::formatted("idle thread #{}", cpu)), 1 << cpu, false);
Thread* idle_thread = s_colonel_process->create_kernel_thread(idle_loop, nullptr, THREAD_PRIORITY_MIN, KString::must_create(String::formatted("idle thread #{}", cpu)), 1 << cpu, false);
VERIFY(idle_thread);
return idle_thread;
}