INtime SDK Help
TerminateThread, RtTerminateThread (iwin32)
INtime SDK v7 > About INtime > Alternate APIs > iwin32 API > iwin32 API > TerminateThread, RtTerminateThread (iwin32)

Terminates the specified thread.

BOOLEAN TerminateThread(
    HANDLE hThread,
    DWORD dwExitCode

BOOLEAN RtTerminateThread(
    HANDLE hThread,
    DWORD dwExitCode
);

Parameters

hThread
Handle to the thread to terminate.
dwExitCode
Specifies the exit code for the thread.

To retrieve a thread's exit value, use GetExitCodeThread.

Remarks

If the target thread is the last thread of a process when this function is called, the thread's process also terminates.

The thread object's state becomes signaled, releasing any other threads waiting for the thread to terminate. The thread's termination status changes from STILL_ACTIVE to the value of the dwExitCode parameter.

If the thread owned one or more mutexes, all threads waiting for such mutexes wake with a WAIT_ABANDONED exception.

RSLs attached to the thread are notified that the thread is terminating.

Terminating a thread does not necessarily remove the thread object from the system. A thread object is deleted when the last thread handle closes.

Return Values

Non-zero
Success.
0 (zero)
Failure. For extended error information, see GetLastError.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/iwin32.h
intime/rt/include/winbase.h
iwin32.h
windows.h
iwin32.lib

Note

See Also

RtCreateProcess, CreateThread, GetExitCodeThread, iwin32 API, iwin32 Overview