mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 11:42:33 +00:00
Windows: use __declspec(thread) TLS implementation, it is MUCH faster… (#21810)
* Windows: use __declspec(thread) TLS implementation, it is MUCH faster than _Thread_local [backport] * Update lib/nimbase.h * better fix
This commit is contained in:
@@ -125,7 +125,13 @@ __AVR__
|
||||
NIM_THREADVAR declaration based on
|
||||
http://stackoverflow.com/questions/18298280/how-to-declare-a-variable-as-thread-local-portably
|
||||
*/
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112 && !defined __STDC_NO_THREADS__
|
||||
#if defined _WIN32
|
||||
# if defined _MSC_VER || defined __DMC__ || defined __BORLANDC__
|
||||
# define NIM_THREADVAR __declspec(thread)
|
||||
# else
|
||||
# define NIM_THREADVAR __thread
|
||||
# endif
|
||||
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112 && !defined __STDC_NO_THREADS__
|
||||
# define NIM_THREADVAR _Thread_local
|
||||
#elif defined _WIN32 && ( \
|
||||
defined _MSC_VER || \
|
||||
|
||||
Reference in New Issue
Block a user