RtTerminateProcess
RtTerminateProcess terminates the specified process and all of its threads.
Syntax
BOOL RtTerminateProcess( HANDLE hProcess, UINT uExitCode );
Parameters
hProcess
Handle to the process to terminate. The handle
must have PROCESS_TERMINATE access.
uExitCode
The exit code for the process and for all threads terminated as a result of this call. Use RtGetExitCodeProcess to retrieve the process's exit value. Use GetExitCodeThread to retrieve a thread's exit value.
Return Value
TRUE if the function succeeds, FALSE if the function fails.
To get extended error information, call GetLastError.
Remarks
RtTerminateProcess is used to unconditionally cause a process to exit.
RtTerminateProcess causes all threads within a process to terminate, and causes a process to exit, but DLLs attached to the process are not notified that the process is terminating.
Caution: Use this function only in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if RtTerminateProcess is used rather than exit or ExitProcess.
Terminating a process causes the following:
- All of the object handles opened by the process are closed.
- All of the threads in the process terminate their execution.
- The state of the process object becomes signaled, satisfying any threads that had been waiting for the process to terminate.
- The states of all threads of the process become signaled, satisfying any threads that had been waiting for the threads to terminate.
- The termination status of the process changes from STILL_ACTIVE to the exit value of the process.
Terminating a process does not cause child processes to be terminated.
Terminating a process does not necessarily remove the process object from the system. A process object is deleted when the last handle to the process is closed.
IMPORTANT! There is risk of a Windows system crash if either the RT-TCP/IP Stack (RtTcpip.rtss) or RTX64 Network Abstraction Layer (RTX64Nal.rtss) processes are terminated.
Requirements
Minimum Supported Version | RTX64 2013 |
Header | Rtapi.h |
Library | RtApi.lib (Windows), Rtx_Rtss.lib (RTSS) |
See Also: