Summary
This episode explores C++11's thread_local storage duration specifier, which creates variables that are global to individual threads. Jason demonstrates how thread_local variables are initialized the first time a thread executes the declaration, maintain their value across function calls within the same thread, and are destroyed when the thread ends. Through multiple examples with C++17's jthread, he illustrates the non-deterministic nature of threading and how thread_local variables maintain separate lifetimes and values for each thread.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[thread.mutex.class]75% match -
[thread.thread.this]75% match -
[basic.start.static]60% match -
[class.static.data]59% match -
[intro.multithread]48% match -
[thread.lock]40% match -
[thread.thread.class]40% match