Asynchronous Terminals and Printer Processes Programming Manual
 TERMINAL PROGRAMMING CONSIDERATIONS
 Using Break (Single Process per Terminal)
 INT BREAK^RECEIVED := 0,
 .RECV^BUF[ 0:66 ];
 Enable BREAK by calling SETMODE 11 and passing the file number
 of the terminal and the CPU and process ID number (
pin
) of the
 owner. For example:
 | CALL SETMODE (TERM^NUM, SET^BREAK^OWNER, ME, NORMAL^MODE);
 |
 |
 | ME is the value returned by the MYPID procedure. MYPID is a
 | process-control procedure that returns the CPU and process ID of
 | the caller. Following this call to SETMODE, the file system
 monitors TERM^NUM for a break signal. If BREAK is pressed, a
 system break message is sent to this process.
 Issue a READ to the $RECEIVE file (open as a nowait file):
 CALL READ ( RECV^FNUM, RECV^BUF, 132 );
 Then periodically check $RECEIVE:
 ERROR := 0;
 CALL AWAITIO ( RECV^FNUM,, NUM^READ,, 0D );
 IF = THEN ... ! user msg received
 ELSE
 IF > THEN ! system msg received
 BEGIN
 IF RECV^BUF = -20 THEN ! BREAK message
 BREAK^RECEIVED := 1;
 This procedure sets a flag that indicates that BREAK was pressed.
 The break is processed in another part of the program:
 ELSE
 IF RECV^BUF = ... THEN ! another system message
 END
 ELSE ! error
 CALL FILEINFO ( RECV^FNUM, ERROR );
 ! if read on $RECEIVE completed, issue another
 IF ERROR <> 40 ! timeout
 THEN
 CALL READ ( RECV^FNUM, RECV^BUF, 132 );
 4-16 November 1987










