34 lines
1.4 KiB
Markdown
34 lines
1.4 KiB
Markdown
[basic.stc.thread]
|
||
|
||
# 6 Basics [[basic]](./#basic)
|
||
|
||
## 6.8 Memory and objects [[basic.memobj]](basic.memobj#basic.stc.thread)
|
||
|
||
### 6.8.6 Storage duration [[basic.stc]](basic.stc#thread)
|
||
|
||
#### 6.8.6.3 Thread storage duration [basic.stc.thread]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/basic.tex#L4320)
|
||
|
||
All variables declared with the thread_local keyword have[*thread storage duration*](#def:storage_duration,thread "6.8.6.3 Thread storage duration [basic.stc.thread]")[.](#1.sentence-1)
|
||
|
||
The storage for these entities lasts for the duration of
|
||
the thread in which they are created[.](#1.sentence-2)
|
||
|
||
There is a distinct object or reference
|
||
per thread, and use of the declared name refers to the entity associated with
|
||
the current thread[.](#1.sentence-3)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/basic.tex#L4328)
|
||
|
||
[*Note [1](#note-1)*:
|
||
|
||
A variable with thread storage duration is initialized as specified
|
||
in [[basic.start.static]](basic.start.static "6.10.3.2 Static initialization"), [[basic.start.dynamic]](basic.start.dynamic "6.10.3.3 Dynamic initialization of non-block variables"), and [[stmt.dcl]](stmt.dcl "8.10 Declaration statement") and, if constructed, is destroyed on thread exit ([[basic.start.term]](basic.start.term "6.10.3.4 Termination"))[.](#2.sentence-1)
|
||
|
||
â *end note*]
|