title: Windows threading: _beginthread vs _beginthreadex vs CreateThread C++
body: <p>What's a better way to start a thread, <code>_beginthread</code>, <code>_beginthreadx</code> or <code>CreateThread</code>?</p>
  
  <p>I'm trying to determine what are the advantages/disadvantages of <code>_beginthread</code>, <code>_beginthreadex</code> and <code>CreateThread</code>.  All of these functions return a thread handle to a newly created thread, I already know that CreateThread provides a little extra information when an error occurs (it can be checked by calling <code>GetLastError</code>)... but what are some things I should consider when I'm using these functions?</p>
  
  <p>I'm working with a windows application, so cross-platform compatibility is already out of the question.</p>
  
  <p>I have gone through the msdn documentation and I just can't understand, for example, why anybody would decide to use _beginthread instead of CreateThread or vice versa.</p>
  
  <p>Cheers!</p>
  
  <p>Update:
  OK, thanks for all the info, I've also read in a couple of places that I can't call <code>WaitForSingleObject()</code> if I used <code>_beginthread()</code>, but if I call <code>_endthread()</code> in the thread shouldn't that work? What's the deal there?</p>