Use MSVC __declspec(thread) for TSD on Windows

This commit is contained in:
Ben Niu 2024-08-30 17:32:42 -07:00 committed by Qi Wang
parent 1c900088c3
commit 3a0d9cdadb
2 changed files with 78 additions and 2 deletions

View file

@ -22,8 +22,12 @@ JEMALLOC_TSD_TYPE_ATTR(tsd_t) tsd_tls = TSD_INITIALIZER;
pthread_key_t tsd_tsd;
bool tsd_booted = false;
#elif (defined(_WIN32))
#if defined(JEMALLOC_LEGACY_WINDOWS_SUPPORT) || !defined(_MSC_VER)
DWORD tsd_tsd;
tsd_wrapper_t tsd_boot_wrapper = {false, TSD_INITIALIZER};
tsd_wrapper_t tsd_boot_wrapper = {TSD_INITIALIZER, false};
#else
JEMALLOC_TSD_TYPE_ATTR(tsd_wrapper_t) tsd_wrapper_tls = { TSD_INITIALIZER, false };
#endif
bool tsd_booted = false;
#if JEMALLOC_WIN32_TLSGETVALUE2
TGV2 tls_get_value2 = NULL;