6
Basics
[basic]
6.7
Memory and objects
[basic.memobj]
6.7.5
Storage duration
[basic.stc]
6.7.5.2
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
:
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
]