diff options
author | Andreas Kling <kling@serenityos.org> | 2023-04-02 19:25:36 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-04 10:33:42 +0200 |
commit | a098266ff5086e52b1af2e11fd1835f4c22a746d (patch) | |
tree | 455695c235d0bbec24517159507831a186f0d1b4 /Kernel/Scheduler.cpp | |
parent | 65438d8a850cd79c343c8e92cec92f9f699f2110 (diff) | |
download | serenity-a098266ff5086e52b1af2e11fd1835f4c22a746d.zip |
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.
Diffstat (limited to 'Kernel/Scheduler.cpp')
-rw-r--r-- | Kernel/Scheduler.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 789b43da54..0905171364 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -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)); |