How adTempus Terminates a Process

The method adTempus uses to terminate a program depends on the type of program, how it’s running, and how cooperative the program is. Before instructing adTempus to terminate a program, understand that there is always a chance that things will not end nicely as a result.

32-Bit Windows Programs

For a 32-bit Windows program (that is, that program that has a window of some sort, as opposed to "console" applications), adTempus uses a two-phased approach. adTempus first sends a “Close” message to the program's main window. This is roughly equivalent to clicking the program's "Close" button or using "End Task" in the Windows Task Manager.

This is the “clean” method of terminating a program, because the program is able to do whatever it normally does when exiting (for example, saving open files and releasing DLLs).

If the program does not respond to this request within 3 minutes, the scheduler switches to the “dirty” approach as described below for 16-bit and non-Windows.

Note that there could be many reasons why a program cannot terminate itself in response to the Close message. For example, the program, upon being told to terminate, may prompt the user to confirm something (such as an unsaved file) before exiting. Unless there is a user logged on who can acknowledge the prompt, the program will wait indefinitely for a response, exceeding its three-minute limit.

Everything Else

For 16-bit programs, or for 32-bit programs that do not display a window, adTempus cannot send the Close message that would allow the program to terminate itself. For these programs—and for 32-bit programs that fail to respond to the Close message—adTempus has to resort to a “dirty” kill. Under this method, adTempus unequivocally terminates the process (this is equivalent to terminating the program from the Windows NT Task Manager’s Process list).

When a program is terminated in this fashion, it is killed immediately and does not have a chance to do any of the things it would normally do before exiting (things like saving files). Furthermore, the program cannot notify any DLLs to which it is attached or other processes with which it may be communicating that it is terminating. This can lead to problems with corruption of global data in DLLs, among other things.

Programs terminated in this manner exit with a return code of 255.