Forcing Termination of a Thread

In certain circumstances, it may be necessary to terminate a secondary thread without waiting for the thread to complete its processing; for example, the user may decide to exit from the application. This capability is provided under OS/2 Version 2.0 using the DosKillThread() function. This function is illustrated in Figure "DosKillThread() Function".

Note that the DosKillThread() function cannot be used to terminate the current thread; if the application attempts to issue a DosKillThread() function call for the current thread, the function will return an error. To terminate a secondary thread from within that thread, the _endthread() function should be used if the thread was created with the _beginthread() function, or the DosExit() function may be used if the thread was created using the DosCreateThread() function.


[Back: Threads Without Object Windows]
[Next: Terminating a Process]