summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/KernelKit/ThreadLocalStorage.inl
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-18 21:39:29 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-18 21:39:29 +0200
commitda70596895d8135e08f8caac6978117697b4c021 (patch)
tree2516785b5434df8453687f05dc8dd877438901ab /dev/Kernel/KernelKit/ThreadLocalStorage.inl
parent005de79004c9d30e64bdee6e14e06f9d47d1f2ab (diff)
[REFACTOR]
Improved project structure. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/KernelKit/ThreadLocalStorage.inl')
-rw-r--r--dev/Kernel/KernelKit/ThreadLocalStorage.inl74
1 files changed, 0 insertions, 74 deletions
diff --git a/dev/Kernel/KernelKit/ThreadLocalStorage.inl b/dev/Kernel/KernelKit/ThreadLocalStorage.inl
deleted file mode 100644
index a5bb1adb..00000000
--- a/dev/Kernel/KernelKit/ThreadLocalStorage.inl
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -------------------------------------------
-
- Copyright ZKA Technologies.
-
-------------------------------------------- */
-
-//! @brief Allocates a pointer from the process's tls.
-
-#ifndef _INC_PROCESS_SCHEDULER_HXX_
-#include <KernelKit/ProcessScheduler.hxx>
-#endif
-
-template <typename T>
-inline T* tls_new_ptr(void)
-{
- using namespace Kernel;
-
- MUST_PASS(ProcessScheduler::The().Leak().TheCurrent());
-
- auto ref_process = ProcessScheduler::The().Leak().TheCurrent();
-
- T* pointer = (T*)ref_process.Leak().New(sizeof(T));
- return pointer;
-}
-
-//! @brief TLS delete implementation.
-template <typename T>
-inline Kernel::Bool tls_delete_ptr(T* ptr)
-{
- if (!ptr)
- return false;
-
- using namespace Kernel;
-
- MUST_PASS(ProcessScheduler::The().Leak().TheCurrent());
-
- auto ref_process = ProcessScheduler::The().Leak().TheCurrent();
- 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
-template <typename T, typename... Args>
-T* tls_new_class(Args&&... args)
-{
- T* ptr = tls_new_ptr<T>();
-
- using namespace Kernel;
-
- if (ptr)
- {
- *ptr = T(forward(args)...);
- return ptr;
- }
-
- return nullptr;
-}
-
-/// @brief Delete a C++ class (call constructor first.)
-/// @tparam T
-/// @param ptr
-/// @return
-template <typename T>
-inline Kernel::Bool tls_delete_class(T* ptr)
-{
- if (!ptr)
- return false;
-
- ptr->~T();
- return tls_delete_ptr(ptr);
-}