6
Basics
[basic]
6.7
Memory and objects
[basic.memobj]
6.7.5
Storage duration
[basic.stc]
6.7.5.3
Thread storage duration
[basic.stc.thread]
1
#
All variables declared with the
thread_
local
keyword have
thread storage duration
.
The storage for these entities lasts for the duration of the thread in which they are created
.
There is a distinct object or reference per thread, and use of the declared name refers to the entity associated with the current thread
.
2
#
[
Note
1
:
A variable with thread storage duration is initialized as specified in
[basic.
start.
static]
,
[basic.
start.
dynamic]
, and
[stmt.
dcl]
and, if constructed, is destroyed on thread exit (
[basic.
start.
term]
)
.
—
end note
]