c:c_threads:thread_local_storage_thread_local
Differences
This shows you the differences between two versions of the page.
c:c_threads:thread_local_storage_thread_local [2021/03/05 16:07] – created peter | c:c_threads:thread_local_storage_thread_local [2021/03/05 16:10] (current) – peter | ||
---|---|---|---|
Line 48: | Line 48: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | < | ||
+ | Value of globalVar in thread 140620033623808 is 5 | ||
+ | Value of globalVar in thread 140620025231104 is 20 | ||
+ | Value of globalVar in MAIN thread is 1 | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | If globalVar was not declared **thread_local** then the returned result would be: | ||
+ | |||
+ | < | ||
+ | Value of globalVar in thread 140275965699840 is 20 | ||
+ | Value of globalVar in thread 140275957307136 is 20 | ||
+ | Value of globalVar in MAIN thread is 20 | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | </ | ||
+ |
c/c_threads/thread_local_storage_thread_local.1614960426.txt.gz · Last modified: 2021/03/05 16:07 by peter