I have often seen the thread functions written like the one below:
DWORD WINAPI MyThreadProc( LPVOID lpParam )
_endthreadex( 0 ); return 0; }
Do we really require to call
in the threads created using
? A big NO is the answer!! and for that matter you don't need a call to
function actually allocates and initializes the per thread data required by the CRT and calls
passing a stub function in CRT as the entrypoint for the thread. This stub function will call your actual thread function(in this case,
) and when your thread function returns, the stub function ensures that it calls
passing the value returned from the thread function.
, the per thread data allocated will be released and
will be called passing the value received in
Reference: threadex.c & thread.c in CRT Source.
Please be free to ask your queries, if any.