Skip to content

Instantly share code, notes, and snippets.

@danielhams
Created August 30, 2019 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielhams/05a3ecb77181b69d6bf5fb563686d833 to your computer and use it in GitHub Desktop.
Save danielhams/05a3ecb77181b69d6bf5fb563686d833 to your computer and use it in GitHub Desktop.
Simple CPP file using thread local variable
#include <thread>
#include <iostream>
thread_local int a=0;
int main(int argc, char** argv) {
std::cout << "a=" << a << std::endl;
std::cout << "It worked!" << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment