ExitThread
ExitThread is a Windows API function in kernel32.dll that terminates the calling thread. It ends the current thread’s execution and assigns the thread’s exit code to the value provided as the dwExitCode parameter. The exit code can later be retrieved by GetExitCodeThread using the thread’s handle. ExitThread affects only the calling thread; the process and other threads continue to run.
Prototype and behavior: ExitThread(DWORD dwExitCode) terminates the calling thread immediately and unwinds the thread’s execution context.
Usage considerations: If the thread was created with the C run-time library (CRT) support, via _beginthread or
Retrieving exit status: After a thread terminates, its exit code can be obtained by calling GetExitCodeThread
Alternatives and cautions: TerminateThread can forcibly stop a thread from another thread and may bypass cleanup,