static void TerminateThread(Handle Thread, unsigned ExitCode)
This function terminates a thread.
The handle of the thread to terminate.
The exit code for the thread.
After termination of the thread, the exit code may be determined via the function GetThreadExitCode.
The memory consumed by the thread's stack is not deallocated upon termination. Any dynamic link libraries that are attached are not notified of the thread's termination.
This method is not the recommended approach to ending a thread. The following may result:
Even though the thread has been terminated, it still remains in the system until its last handle has been closed via the function CloseHandle.
If the thread being terminated is the last thread in the process, the process is also terminated.
Any handles for the thread enter the signalled state upon termination.
The recommended approach for a thread to terminate itself is: