title: threading support in Clang++ 3.3 for C++11
body: <p>the code at the bottom of this post compiles fine but generates an useless binary with </p>
  
  <pre><code>$ clang++ -v
  clang version 3.3 (trunk 168461)
  Target: x86_64-unknown-linux-gnu
  Thread model: posix
  </code></pre>
  
  <p>when this command is given</p>
  
  <pre><code>clang++ -std=c++11 -pthread -s -O3 -DNDEBUG source.cpp -o source
  </code></pre>
  
  <p>the binary always generates this</p>
  
  <pre><code>terminate called after throwing an instance of 'std::system_error'
    what():  Operation not permitted
  Aborted (core dumped)
  </code></pre>
  
  <p>What I don't get is:</p>
  
  <ul>
  <li>why i need to link the POSIX threads library if C++11 includes a threading model in the standard, why the flag <code>-std=c++11</code> it's not enough ?</li>
  <li>if clang++ supports <code>-pthread</code> or not, according to what I have read it should support pthreads</li>
  </ul>
  
  <p>Thanks.</p>
  
  <hr>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;thread&gt;
  
  void f()
  {
    std::cout &lt;&lt; "Hello World\n";
  }
  
  int main()
  {
    std::thread t(f);
    t.join();
  }
  </code></pre>