Files
2025-10-25 03:02:53 +03:00

34 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.3Thread 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.2Static initialization"), [[basic.start.dynamic]](basic.start.dynamic "6.10.3.3Dynamic initialization of non-block variables"), and [[stmt.dcl]](stmt.dcl "8.10Declaration statement") and, if constructed, is destroyed on thread exit ([[basic.start.term]](basic.start.term "6.10.3.4Termination"))[.](#2.sentence-1)
— *end note*]