mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
Kernel: Use TRY() in sys$create_thread()
This commit is contained in:
parent
257fa80312
commit
bfe4c84541
1 changed files with 2 additions and 8 deletions
|
@ -41,11 +41,7 @@ KResultOr<FlatPtr> Process::sys$create_thread(void* (*entry)(void*), Userspace<c
|
||||||
|
|
||||||
// FIXME: Do something with guard pages?
|
// FIXME: Do something with guard pages?
|
||||||
|
|
||||||
auto thread_or_error = Thread::try_create(*this);
|
auto thread = TRY(Thread::try_create(*this));
|
||||||
if (thread_or_error.is_error())
|
|
||||||
return thread_or_error.error();
|
|
||||||
|
|
||||||
auto& thread = thread_or_error.value();
|
|
||||||
|
|
||||||
// We know this thread is not the main_thread,
|
// We know this thread is not the main_thread,
|
||||||
// So give it a unique name until the user calls $set_thread_name on it
|
// So give it a unique name until the user calls $set_thread_name on it
|
||||||
|
@ -68,9 +64,7 @@ KResultOr<FlatPtr> Process::sys$create_thread(void* (*entry)(void*), Userspace<c
|
||||||
#endif
|
#endif
|
||||||
regs.cr3 = address_space().page_directory().cr3();
|
regs.cr3 = address_space().page_directory().cr3();
|
||||||
|
|
||||||
auto tsr_result = thread->make_thread_specific_region({});
|
TRY(thread->make_thread_specific_region({}));
|
||||||
if (tsr_result.is_error())
|
|
||||||
return tsr_result.error();
|
|
||||||
|
|
||||||
PerformanceManager::add_thread_created_event(*thread);
|
PerformanceManager::add_thread_created_event(*thread);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue