mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:15:08 +00:00
Kernel: Simplify Process factory functions
- Instead of taking the first new thread as an out-parameter, we now bundle the process and its first thread in a struct and use that as the return value. - Make all Process factory functions return ErrorOr. Use this to convert some places to more TRY(). - Drop the "try_" prefix on Process factory functions.
This commit is contained in:
parent
65438d8a85
commit
a098266ff5
12 changed files with 319 additions and 78 deletions
|
@ -366,13 +366,11 @@ UNMAP_AFTER_INIT void Scheduler::initialize()
|
|||
VERIFY(Processor::is_initialized()); // sanity check
|
||||
VERIFY(TimeManagement::is_initialized());
|
||||
|
||||
LockRefPtr<Thread> idle_thread;
|
||||
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, KString::must_create("colonel"sv), idle_loop, nullptr, 1, Process::RegisterProcess::No).leak_ref();
|
||||
VERIFY(s_colonel_process);
|
||||
VERIFY(idle_thread);
|
||||
auto [colonel_process, idle_thread] = MUST(Process::create_kernel_process(KString::must_create("colonel"sv), idle_loop, nullptr, 1, Process::RegisterProcess::No));
|
||||
s_colonel_process = &colonel_process.leak_ref();
|
||||
idle_thread->set_priority(THREAD_PRIORITY_MIN);
|
||||
idle_thread->set_name(KString::must_create("Idle Task #0"sv));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue