Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 20
Controlling the Priority of a New Process
message containing optional display text. The structure for rejecting a process-
creation request is as follows:
Controlling the Priority of a New Process
The PROCESSCREATION^MSG.PRIORITY variable in the request received by
$CMON contains the priority requested by the user for the new process. If the user
does not specify a priority, then this variable contains -1; a priority of -1 is interpreted
as a priority of 1 less than that of the TACL process.
To accept the user’s request for priority, $CMON either copies the requested (positive)
priority into the PROCESSCREATION^ACCEPT.PRIORITY variable, or assigns a
value of 0 to the variable (to indicate no change), and then sends the reply. To change
the priority requested by the user, $CMON can either put the new value into the reply
message, or it can put a negative value into the reply message; a negative value is
added to the requested value, resulting in a reduced priority.
In the following example, the user’s choice for priority is accepted unless the user
requests a priority greater than 175. Here, $CMON reduces the priority to 175. The
values for the program-file name and CPU number are returned unchanged:
CALL READUPDATEX(RECV^NUM,SBUFFER,RCOUNT,BYTES^READ);
IF BUFFER[0] = -52 THEN
BEGIN
PROCESSCREATION^MSG ':=' SBUFFER FOR
$LEN(PROCESSCREATION^MSG);
IF PROCESSCREATION^MSG.PRIORITY > 175
THEN PROCESSCREATION^ACCEPT.PRIORITY := 175
ELSE PROCESSCREATION^ACCEPT.PRIORITY := 0;
PROCESSCREATION^ACCEPT.PROGNAME ':='
PROCESSCREATION^MSG.PROGNAME FOR 12;
PROCESSCREATION^ACCEPT.PROCESSOR :=
PROCESSCREATION^MSG.PROCESSOR;
CALL REPLYX(PROCESSCREATION^ACCEPT,
$LEN(PROCESSCREATION^ACCEPT));
END;
Format of Processcreation^reject structure:
STRUCT PROCESSCREATION^REJECT;
BEGIN
INT REPLYCODE; ![0] 1 to reject process creation
STRING REPLYTEXT[0:n]; ![1] optional message to be
! displayed; maximum 132
! bytes
END;