From 0511c53e648e5f253cd9e83c9e211aa6600db377 Mon Sep 17 00:00:00 2001 From: Amlal Date: Mon, 28 Oct 2024 19:29:04 +0100 Subject: META: Bumping source code. Signed-off-by: Amlal --- dev/ZKAKit/KernelKit/ThreadLocalStorage.inl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'dev/ZKAKit/KernelKit/ThreadLocalStorage.inl') diff --git a/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl b/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl index 305d3966..9f64ae55 100644 --- a/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl +++ b/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl @@ -16,11 +16,15 @@ inline T* tls_new_ptr(void) noexcept { using namespace Kernel; - auto ref_process = UserProcessScheduler::The().CurrentProcess(); + auto ref_process = UserProcessScheduler::The().GetCurrentProcess(); MUST_PASS(ref_process); - T* pointer = (T*)ref_process.Leak().New(sizeof(T)); - return pointer; + auto pointer = ref_process.Leak().New(sizeof(T)); + + if (pointer.Error()) + return nullptr; + + return reinterpret_cast(pointer.Leak().Leak()); } //! @brief TLS delete implementation. @@ -28,21 +32,21 @@ template inline Kernel::Bool tls_delete_ptr(T* ptr) noexcept { if (!ptr) - return false; + return No; using namespace Kernel; - auto ref_process = UserProcessScheduler::The().CurrentProcess(); + auto ref_process = UserProcessScheduler::The().GetCurrentProcess(); MUST_PASS(ref_process); return ref_process.Leak().Delete(ptr, sizeof(T)); } /// @brief Allocate a C++ class, and then call the constructor of it. -/// @tparam T -/// @tparam ...Args -/// @param ...args -/// @return +/// @tparam T class type. +/// @tparam ...Args varg class type. +/// @param ...args arguments list. +/// @return Class instance. template T* tls_new_class(Args&&... args) { -- cgit v1.2.3