What\'s a better way to start a thread, _beginthread
, _beginthreadx
or CreateThread
?
I\'m trying to determine what are the adv
In general, the correct thing to do is to call _beginthread()/_endthread()
(or the ex()
variants). However, if you use the CRT as a .dll, the CRT state will be properly initialized and destroyed as the CRT's DllMain
will be called with DLL_THREAD_ATTACH
and DLL_THREAD_DETACH
when calling CreateThread()
and ExitThread()
or returning, respectively.
The DllMain
code for the CRT can be found in the install directory for VS under VC\crt\src\crtlib.c.