From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/language%2Fthread_storage_duration.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 devdocs/c/language%2Fthread_storage_duration.html (limited to 'devdocs/c/language%2Fthread_storage_duration.html') diff --git a/devdocs/c/language%2Fthread_storage_duration.html b/devdocs/c/language%2Fthread_storage_duration.html new file mode 100644 index 00000000..8f92d562 --- /dev/null +++ b/devdocs/c/language%2Fthread_storage_duration.html @@ -0,0 +1,14 @@ +

Thread storage duration

An object whose identifier is declared with the storage-class specifier _Thread_local (since C11) has thread storage duration. Its lifetime is the entire execution of the thread for which it is created, and its stored value is initialized when the thread is started. There is a distinct object per thread, and use of the declared name in an expression refers to the object associated with the thread evaluating the expression. The result of attempting to indirectly access an object with thread storage duration from a thread other than the one with which the object is associated is implementation-defined.

+

Example

const double PI = 3.14159;         /* const variable is global to all threads  */
+_Thread_local unsigned int seed;   /* seed is a thread-specific variable       */
+ 
+int main(void)
+{
+    return 0;
+}

Possible output:

+
(none)
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/language/thread_storage_duration +

+
-- cgit v1.2.3