Skip to content

Commit

Permalink
Use _Thread_local to solve threads.h build issue (valkey-io#1053)
Browse files Browse the repository at this point in the history
Apparently this will fail to compile in some masOS version.
And internet claims _Thread_local is portable.

Fixes valkey-io#1051.

Signed-off-by: Binbin <binloveplay1314@qq.com>
  • Loading branch information
enjoy-binbin authored and PingXie committed Oct 9, 2024
1 parent 3918e4e commit c858b9a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/zmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <threads.h>
#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. */
Expand Down

0 comments on commit c858b9a

Please sign in to comment.