要不要调用_endthreadex
http://msdn.microsoft.com/en-us/library/kdzttdcb(VS.80).aspx
You can call _endthread or _endthreadex explicitly to terminate a thread; however, _endthread or _endthreadex is called automatically when the thread returns from the routine passed as a parameter. Terminating a thread with a call to endthread or _endthreadex helps to ensure proper recovery of resources allocated for the thread.
这里说函数返回时会自动调用,但是后面举的例子里全部手动调用了 _endthreadex
....
unsigned Counter;
unsigned __stdcall SecondThreadFunc( void* pArguments )
{
printf( "In second thread...\n" );
while ( Counter < 1000000 )
Counter++;
_endthreadex( 0 );
return 0;
}
....
WHY???