summaryrefslogtreecommitdiffhomepage
path: root/KernelKit/ThreadLocalStorage.inl
diff options
context:
space:
mode:
authoramlel <113760121+amlel-png@users.noreply.github.com>2024-01-09 21:49:17 +0100
committerGitHub <noreply@github.com>2024-01-09 21:49:17 +0100
commit149ad21b7188d21d726215c98d0d74835ea4e737 (patch)
tree673b3db2a203630aa097bbf77b1c8cd5487318bc /KernelKit/ThreadLocalStorage.inl
parenta8cf25e6b66425d89b25381bb07fd4074cdc8deb (diff)
parente761991ab5a1d51392d098a15c1870025900fcd1 (diff)
Merge pull request #1 from Mahrouss-Logic/kernel-tls
Kernel tls
Diffstat (limited to 'KernelKit/ThreadLocalStorage.inl')
-rw-r--r--KernelKit/ThreadLocalStorage.inl48
1 files changed, 24 insertions, 24 deletions
diff --git a/KernelKit/ThreadLocalStorage.inl b/KernelKit/ThreadLocalStorage.inl
index c117dd4e..bf036366 100644
--- a/KernelKit/ThreadLocalStorage.inl
+++ b/KernelKit/ThreadLocalStorage.inl
@@ -12,39 +12,39 @@
template <typename T>
inline T* hcore_tls_new_ptr(void)
{
- using namespace hCore;
-
- auto ref_process = ProcessManager::Shared().Leak().GetCurrent();
-
- T* pointer = (T*)ref_process.Leak().New(sizeof(T));
- return pointer;
+ using namespace hCore;
+
+ auto ref_process = ProcessManager::Shared().Leak().GetCurrent();
+
+ T* pointer = (T*)ref_process.Leak().New(sizeof(T));
+ return pointer;
}
//! @brief TLS delete implementation.
template <typename T>
inline bool hcore_tls_delete_ptr(T* ptr)
{
- if (!ptr)
- return false;
-
- using namespace hCore;
-
- auto ref_process = ProcessManager::Shared().Leak().GetCurrent();
- ptr->~T();
-
- return ref_process.Leak().Delete(ptr, sizeof(T));
+ if (!ptr)
+ return false;
+
+ using namespace hCore;
+
+ auto ref_process = ProcessManager::Shared().Leak().GetCurrent();
+ ptr->~T();
+
+ return ref_process.Leak().Delete(ptr, sizeof(T));
}
template <typename T, typename... Args>
T* hcore_tls_new_class(Args&&... args)
{
- T* ptr = hcore_tls_new_ptr<T>();
-
- if (ptr)
- {
- *ptr = T(hCore::forward(args)...);
- return ptr;
- }
-
- return nullptr;
+ T* ptr = hcore_tls_new_ptr<T>();
+
+ if (ptr)
+ {
+ *ptr = T(hCore::forward(args)...);
+ return ptr;
+ }
+
+ return nullptr;
}