SPRAB89A September 2011 – March 2014
Over the years, C and C++ have been extended to allow definition of thread-local variables:
__thread
storage qualifier as a C/C++ language extension. This is not an official language extension, however.
__declspec(thread)
storage attribute extension.
thread_local
storage class specifier.
_Thread_local
storage class specifier.
The language extension used to support thread-local storage is toolchain-specific and outside the scope of the ABI.
Thread-local variables can be initialized or uninitialized. Uninitialized thread-local variables are initialized to zero, as with uninitialized global and static variables. Allocation and initialization of thread-local variables occurs when the thread is created, whether statically or dynamically.