From d07c29791a4cecd8bce76b05d046981f39fe5fcd Mon Sep 17 00:00:00 2001 From: Binbin Date: Sun, 22 Sep 2024 20:20:55 +0800 Subject: [PATCH] Use _Thread_local to solve threads.h build issue (#1053) Apparently this will fail to compile in some masOS version. And internet claims _Thread_local is portable. Fixes #1051. Signed-off-by: Binbin --- src/zmalloc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/zmalloc.c b/src/zmalloc.c index 7b19107b6..7f9d7f688 100644 --- a/src/zmalloc.c +++ b/src/zmalloc.c @@ -88,11 +88,7 @@ void zlibc_free(void *ptr) { #define dallocx(ptr, flags) je_dallocx(ptr, flags) #endif -#if __STDC_NO_THREADS__ -#define thread_local __thread -#else -#include -#endif +#define thread_local _Thread_local #define MAX_THREADS_NUM (IO_THREADS_MAX_NUM + 3 + 1) /* A thread-local storage which keep the current thread's index in the used_memory_thread array. */