DosKillThread allows a thread to end another thread in the current process.

DosKillThread returns to the caller without waiting for the ending thread to complete its termination processing.

You cannot use this function to end the current thread. If you use DosKillThread to end thread 1, the entire process ends. This is similar to issuing DosExit for thread 1.

If the thread to be ended is executing 16-bit code, or has been created by a 16-bit request, ERROR_BUSY is returned.

This function will not terminate a thread that is suspended. Instead the suspended thread will be terminated when it resumes execution. For this reason, you should not kill the main thread of an application if there are any secondary threads that are suspended.

Note: This function is very powerful and must be used with extreme caution. It should be used only when the state of the target thread is known.