Replies: 3 comments
-
@LADSoft can you please reopen and answer the question? I guess (haven't checked in depth) that additional to those two the |
Beta Was this translation helpful? Give feedback.
-
bearing in mind I don't have extensive knowledge of how this is done in other compilers, I did some research. __declspec(thread) does the same thing as _Thread_Local for windows platforms. __thread the same as _Thread_Local for gcc. Gcc actually prefers you use _Thread_Local I imagine as __thread seems to predate the C11 standard.... The implementations seem different in windows compilers than gcc I think but from what I can tell the results would be the same for all three independent of platform. Is there a need for me to add the aliases? |
Beta Was this translation helpful? Give feedback.
-
The declspec would definitely be needed for a win32 compiler, the thread_local (all lower case, needs threads.h be included) should be available, too - asking support for the GCC extension (like clang did) seems reasonable.
|
Beta Was this translation helpful? Give feedback.
-
This is the first time I see them in C source code, too. From the comment, I know
__declspec(thread)
is for MSVC and__thread
is for GCC/Clang.Beta Was this translation helpful? Give feedback.
All reactions