Thread-Local Storage

The compilation environment supports the declaration of thread-local data. This data is sometimes
referred to as thread-specific, or thread-private data, but more typically by the
acronym TLS. By declaring variables to be thread-local, the compiler automatically arranges for
these variables to be allocated on a per-thread basis.

The built-in support for this feature serves three purposes.

A foundation is provided upon which the POSIX interfaces for allocating thread specific data are built.

A convenient, and efficient mechanism for direct use of thread local variables by applications and libraries is provided.

Compilers can allocate TLS as necessary when performing loop-parallelizing optimizations.