GDSX (Extended General Device Support) Manual

Service Routines
Extended General Device Support (GDSX) Manual529931-001
8-80
STOP^TASK
2. This example uses WAIT^EVENT to handle a timeout:
CALL ^READUPDATE ( 0 );
IF <> THEN CALL DEBUG; ! DO ERROR HANDLING
CALL ^SIGNALTIMEOUT ( 100D, , , IOCBADDR);
IF < THEN
BEGIN
! NO IOCB AVAILABLE
END
ELSE IF > THEN
BEGIN
! CODING BUG: TIMEOUT PARAMETER ILLEGAL
END;
! WAIT FOR ALL EVENT TYPES FOR 500 TICKS
EVENT := WAIT^EVENT ( -1, 500D );
! ONLY LISTEN FOR $RECEIVE-TYPE REQUESTS
@LOCAL^IOCB := ^LISTEN ( 1, 0, 0 );
@WAIT^BUFFER := LOCAL^IOCB.BUFADDR;
IF EVENT = 0 AND WAIT^BUFFER[0] = -22 THEN
BEGIN ! HANDLE SIGNALTIMEOUT
! BUFFER ALLOCATED BY TSCODE NEED NOT BE RELEASED
CALL REPLYX( , , , , , IOCBADDR );
! DO OTHER PROCESSING AS DESIRED
END; ! HANDLE SIGNALTIMEOUT
! HANDLE OTHER EVENT TYPES
STOP^TASK
Any task can call this procedure to stop itself and deallocate TCB, IOCBs, FCBs and
other resources, such as all of the task’s allocations from the memory pools. Any
devices or processes opened against this task receive a file-system error 66. Any I/O
not yet completed is canceled. The USER^STOP exit is called, allowing you to clean
up any remaining work. If there is a backup process, it is updated.
Consideration
If a user task detects an E^STOP event by a call to WAIT^EVENT, the task should call
STOP^TASK.
TAKEBREAK
A task calls this procedure to take break ownership of the terminal it controls. To
release break ownership, call GIVEBREAK.
The BREAKENABLED configuration parameter determines whether user tasks can
take break ownership by the TAKEBREAK procedure. If BREAKENABLED is set to 1,
user tasks can successfully call the TAKEBREAK procedure. Otherwise, calls to
TAKEBREAK return file-system error 99.
CALL STOP^TASK