Guardian Programmer's Guide

Table Of Contents
Writing a Server Program
Guardian Programmer’s Guide 421922-014
22 - 58
The Order-Query Server ($SER3)
!------------------------------------------------------------
! Procedure to process a Close system message. This
! procedure removes the requester from the opener table.
!------------------------------------------------------------
PROC PROCESS^CLOSE^MESSAGE;
BEGIN
INT I;
INT J;
INT COUNT;
! Check that the closing process is in the opener table.
! If so, remove the entry from the opener table and
! decrement the count of openers:
I := 1;
WHILE I <= MAX^OPENERS DO
BEGIN
J := 0;
COUNT := 0;
WHILE J <= (ZSYS^VAL^PHANDLE^WLEN - 1) DO
BEGIN
IF RECEIVE^INFO[J + 6] =
OPENER^TABLE.OCB[I].PROCESS^HANDLE[J]
THEN COUNT := COUNT + 1;
J := J + 1;
END;
IF COUNT = ZSYS^VAL^PHANDLE^WLEN AND
RECEIVE^INFO[3] = OPENER^TABLE.OCB[I].FILE^NUMBER THEN
BEGIN
OPENER^TABLE.OCB[I].PROCESS^HANDLE ':='
ZSYS^VAL^PHANDLE^WLEN * [-1];
OPENER^TABLE.CURRENT^COUNT :=
OPENER^TABLE.CURRENT^COUNT - 1;
REPLY^ERROR := 0;
RETURN;
END;
I := I + 1;
END;
! If calling process not in opener table, return error 60:
REPLY^ERROR := 60;
END;