1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-04 05:57:35 +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:
Andreas Kling 2023-04-02 19:25:36 +02:00
parent 65438d8a85
commit a098266ff5
12 changed files with 319 additions and 78 deletions

View file

@ -42,12 +42,11 @@ static HashTable<NonnullRefPtr<TCPSocket>>* delayed_ack_sockets;
void NetworkTask::spawn()
{
LockRefPtr<Thread> thread;
auto name = KString::try_create("Network Task"sv);
if (name.is_error())
TODO();
(void)Process::create_kernel_process(thread, name.release_value(), NetworkTask_main, nullptr);
network_task = thread;
auto [_, first_thread] = MUST(Process::create_kernel_process(name.release_value(), NetworkTask_main, nullptr));
network_task = first_thread;
}
bool NetworkTask::is_current()