From 17014097631bbb68201f793b485233db39415862 Mon Sep 17 00:00:00 2001 From: bjorn Date: Fri, 5 Jan 2024 14:24:11 -0800 Subject: [PATCH] threads polyfill defines thread_local; Might need to be removed for C23. --- src/lib/std/threads.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/std/threads.h b/src/lib/std/threads.h index 0a1fb6d6..bd0ce21e 100644 --- a/src/lib/std/threads.h +++ b/src/lib/std/threads.h @@ -13,11 +13,13 @@ enum { mtx_plain }; typedef HANDLE thrd_t; typedef CRITICAL_SECTION mtx_t; typedef CONDITION_VARIABLE cnd_t; +#define thread_local __declspec(thread) #else #include typedef pthread_t thrd_t; typedef pthread_mutex_t mtx_t; typedef pthread_cond_t cnd_t; +#define thread_local _Thread_local #endif static inline int thrd_create(thrd_t* thread, thrd_start_t fn, void* arg);