title: C++ thread_local with different threading library than std::thread
body: <p>C++11 has keyword thread_local. I wanted to know whether this keyword works as expected only with threads created using standard library (std::thread) or it is guaranteed to work with other threading libraries e.g. Windows CreateThread function or Unix pthread.</p>
  
  <p><a href="https://docs.microsoft.com/en-us/cpp/cpp/thread" rel="nofollow noreferrer">Microsoft documentation for visual studio</a> states that:</p>
  
  <blockquote>
    <p>The thread extended storage-class modifier is used to declare a thread local variable. For the portable equivalent in C++11 and later, use the thread_local storage class specifier for portable code. On Windows thread_local is implemented with __declspec(thread).</p>
  </blockquote>
  
  <p>So thread_local works as expected in MS Visual Studio. I still wonder if the situation is true for other compilers and platforms.</p>