summaryrefslogtreecommitdiff
path: root/lib/libc/thread/thrd_current.c
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-16 17:02:05 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-16 17:02:05 +0100
commit90dad97fc07f049383903a166631e2c257f9b8c1 (patch)
tree096cd247ecfda9e46598215a4f32aecedeedda90 /lib/libc/thread/thrd_current.c
parent0e832a9329cc4d4647e1ce529846073f21e66991 (diff)
Add support for TLS in the libc
Diffstat (limited to 'lib/libc/thread/thrd_current.c')
-rw-r--r--lib/libc/thread/thrd_current.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/thread/thrd_current.c b/lib/libc/thread/thrd_current.c
index 69a99723..b588cc27 100644
--- a/lib/libc/thread/thrd_current.c
+++ b/lib/libc/thread/thrd_current.c
@@ -1,8 +1,9 @@
-#include <__thread.h> // for __thread_self
-#include <threads.h> // for thrd_current, thrd_t
+#include <__thread.h>
+#include <threads.h>
+
+thread_local struct __thread_self __thread_self;
thrd_t thrd_current(void)
{
- static struct __thread_self self = { 0 };
- return &self;
+ return &__thread_self;
}