'How is the thread_local keyword implemented?

I know that Windows and Pthreads have their own TLS API but what I'm asking is how the thread_local keyword is implemented in the C++ compiler (or does it simply call these Windows/Pthreads API?).

I found an answer here about a table of slots in each thread but I still don't really understand it. Can anyone explain?

c++


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source