ExitThread is the preferred method of exiting a thread in C code. However, in C++ code, the thread is exited before any destructors can be called or any other automatic cleanup can be performed. Therefore, in C++ code, you should return from your thread function.
可以给一个退出code,Use the GetExitCodeThread function to retrieve a thread's exit code.
其它的跟return dwExitCode;一样
然后ExitThread()函数将使用线程立刻退出,作为线程自身,它永远无法知道自己执行到哪里,在系统内的清理工作也无法完成。一个线程在退出的时候,无论你是使用return还是_endThread(),系统都会调用ExitThread(),无过是在清理过程完成之后。因此,建议不要使用ExitThread()函数。return是最好的做法。
thank you all