What\'s a better way to start a thread, _beginthread
, _beginthreadx
or CreateThread
?
I\'m trying to determine what are the adv
Compared to _beginthread
, with _beginthreadex
you can:
OpenThread
.CloseHandle
.The _beginthreadex
closely resembles CreateThread
, but the former is a CRT implementation and the latter a Windows API call. The documentation for CreateThread contains the following recommendation:
A thread in an executable that calls the C run-time library (CRT) should use the _beginthreadex and _endthreadex functions for thread management rather than
CreateThread
and ExitThread; this requires the use of the multi-threaded version of the CRT. If a thread created usingCreateThread
calls the CRT, the CRT may terminate the process in low-memory conditions.