mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 17:58:49 +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
Notes:
sideshowbarker
2024-07-17 05:05:51 +09:00
Author: https://github.com/awesomekling
Commit: a098266ff5
Pull-request: https://github.com/SerenityOS/serenity/pull/18163
Reviewed-by: https://github.com/Hendiadyoin1
12 changed files with 319 additions and 78 deletions
|
@ -24,11 +24,10 @@ UNMAP_AFTER_INIT void WorkQueue::initialize()
|
|||
|
||||
UNMAP_AFTER_INIT WorkQueue::WorkQueue(StringView name)
|
||||
{
|
||||
LockRefPtr<Thread> thread;
|
||||
auto name_kstring = KString::try_create(name);
|
||||
if (name_kstring.is_error())
|
||||
TODO();
|
||||
(void)Process::create_kernel_process(thread, name_kstring.release_value(), [this] {
|
||||
auto [_, thread] = Process::create_kernel_process(name_kstring.release_value(), [this] {
|
||||
#if ARCH(AARCH64)
|
||||
// FIXME: This function expects to be executed with interrupts disabled, however on
|
||||
// aarch64 we spawn (kernel) threads with interrupts enabled, so we need to disable them.
|
||||
|
@ -52,9 +51,8 @@ UNMAP_AFTER_INIT WorkQueue::WorkQueue(StringView name)
|
|||
}
|
||||
[[maybe_unused]] auto result = m_wait_queue.wait_on({});
|
||||
}
|
||||
});
|
||||
// If we can't create the thread we're in trouble...
|
||||
m_thread = thread.release_nonnull();
|
||||
}).release_value_but_fixme_should_propagate_errors();
|
||||
m_thread = move(thread);
|
||||
}
|
||||
|
||||
void WorkQueue::do_queue(WorkItem& item)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue