From Jason Turner
Watch on YouTube

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.

Resources

Tags