Guardian Programmer's Guide

Table Of Contents
Creating and Managing Processes
Guardian Programmer’s Guide 421922-014
16 - 47
Deleting Processes
A simple way to check whether the condition that caused one of these messages
caused a specific process to stop is to use the CHILD_LOST_ procedure. You supply
the CHILD_LOST_ procedure with the message read from $RECEIVE and the process
handle of the child process that you wish to monitor. For example:
INT BUFFER[0:511];
STRING .SBUFFER := @SBUFFER '<<' 1;
.
.
CALL READUPDATEX(RECV^NUM,SBUFFER,RCOUNT,BYTES^READ);
CALL FILE_GETINFO_(RECV^NUM, ERROR);
IF (ZFILE^ERR^SYSMESS = ERROR) THEN
BEGIN
...
IF (BUFFER = -2) OR (BUFFER = -100) OR (BUFFER = -101)
OR (BUFFER = -110) THEN
BEGIN
ERROR := CHILD_LOST_(SBUFFER:BYTES^READ,PROCESS^HANDLE);
IF ERROR = 4 THEN ... !the specified process is lost
IF ERROR = 0 THEN ... !the specified process is still
! running
.
.
END;
END;
The returned value is 4 if the message identified the specified process as lost. This
value is 0 if the message did not indicate that the specified process was lost.
Deleting Processes
Use the PROCESS_STOP_ procedure to delete processes. PROCESS_STOP_
allows you to delete your own process or delete another process so long as you have
the authority to do so.
When you delete a process, the operating system sends a Process deletion message
(
message number -101) to the creator process indicating that the process no longer
exists. If the process is part of a job, the operating system also sends the Process
deletion message to the job ancestor.
For an unnamed process, the operating system sends the system message to the
m
om process as specified in the mom field in the PCB of the terminating process. For
a named process, the operating system sends the system message to the ancestor
process as indicated in the DCT.