From a0a6ad3cf9568ca75269e51b43f60bdc0029f86b Mon Sep 17 00:00:00 2001 From: Daan Leijen Date: Fri, 3 Jan 2025 08:17:32 -0800 Subject: [PATCH] add thread_local for c++ --- include/mimalloc/internal.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/mimalloc/internal.h b/include/mimalloc/internal.h index df358e39..4a798d0a 100644 --- a/include/mimalloc/internal.h +++ b/include/mimalloc/internal.h @@ -38,6 +38,12 @@ terms of the MIT license. A copy of the license can be found in the file #define mi_decl_cache_align __attribute__((aligned(MI_CACHE_LINE))) #define mi_decl_weak __attribute__((weak)) #define mi_decl_hidden __attribute__((visibility("hidden"))) +#elif __cplusplus >= 201103L // c++11 +#define mi_decl_noinline +#define mi_decl_thread thread_local +#define mi_decl_cache_align alignas(MI_CACHE_LINE) +#define mi_decl_weak +#define mi_decl_hidden #else #define mi_decl_noinline #define mi_decl_thread __thread // hope for the best :-)