summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKAKit/KernelKit/ThreadLocalStorage.inl
diff options
context:
space:
mode:
authorAmlal <amlal.elmahrouss@icloud.com>2024-10-28 19:29:04 +0100
committerAmlal <amlal.elmahrouss@icloud.com>2024-10-28 19:29:04 +0100
commit0511c53e648e5f253cd9e83c9e211aa6600db377 (patch)
tree84cabfcb7c3b77d554c6c217ff32c1c5c39d74d5 /dev/ZKAKit/KernelKit/ThreadLocalStorage.inl
parentd5c125378d54ceaad7e34e8bac337d9b4665573e (diff)
META: Bumping source code.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKAKit/KernelKit/ThreadLocalStorage.inl')
-rw-r--r--dev/ZKAKit/KernelKit/ThreadLocalStorage.inl22
1 files changed, 13 insertions, 9 deletions
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<T*>(pointer.Leak().Leak());
}
//! @brief TLS delete implementation.
@@ -28,21 +32,21 @@ template <typename T>
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 <typename T, typename... Args>
T* tls_new_class(Args&&... args)
{