title: Difference between pthread_exit, pthread_join and pthread_detach
body: <p>I am complete new to pthreads and I wonder what the exact differences are.</p>
  
  <p>pthread_exit exits a thread. and thus pthread_join will return; However what does detach do that is different from pthread_join?</p>
  
  <p>for instance I create a thread and lets say the thread is finished and I want to completely terminate the thread so I can recreate it later. What is better to use. pthread_join or pthread_detach?</p>
  
  <p>so the order of execution is</p>
  
  <pre><code>pthread_exit();
  pthread_join(); or pthread_detach();
  </code></pre>
  
  <p>?</p>