static void ExitThread(unsigned Code)
This function exits the calling thread.
The exit code for the thread.
The function GetThreadExitCode may be used to obtain the exit code of a thread.
The thread's stack is deallocated. The entry point of all dynamic link libraries attached to the process is called with a value indicating that a thread is terminating. Exiting a thread does not remove the thread from the system. The thread is removed from the system when the last handle for the thread is closed. A thread handle is closed upon calling the function CloseHandle.
Upon exit, the thread's handle enters the signalled state, causing any other threads waiting upon its handle to be released.
If this is the last thread for the process, the process is also terminated.
See notes for the function CreateThread for comments regarding serialization of certain functions.