GDSX Manual

Service Routines
Extended General Device Support (GDSX) Manual134303
8-85
WAIT^EVENT
timeout input
INT(32):value
specifies the number of ticks (10 ms) to wait for the I/O to complete.
Consideration
The procedure sets condition codes in the same manner as AWAITIO. ^FILEINFO may
be called to retrieve error information.
WAIT^EVENT
Instead of using ^AWAITIO[X], which tests only for I/O completions, a multithreaded
DEVICE^HANDLER or LINE^HANDLER task uses the WAIT^EVENT procedure to
check for I/O completions and other asynchronous events. When you specify a set of
event types to look for, WAIT^EVENT returns an indication of which of those types of
events has occurred. The ^LISTEN procedure can then be used to get the address of any
associated IOCB, which in turn can be used to locate the message buffer (as was done in
the control block tracing exercise in Section 5). TSCODE does not automatically move
data from an IOCB to a message buffer when WAIT^EVENT is called as it does when
^READUPDATE is called on a pseudo-$RECEIVE file.
When the WAIT^EVENT procedure is called, control is transferred to TSCODE, which
checks to see if certain events have occurred. The events to be checked are specified in a
bit-encoded mask passed to TSCODE along with a timeout parameter. If one of these
events occurs within the timeout period, TSCODE awakens the calling task and returns
the lowest numbered masked event that has occurred (see the third column of Table 8-1
on page 8-4). Each call to WAIT^EVENT clears the event returned while retaining
those of lower priority That is, those with higher event numbers.
The event descriptions and the global literals (declared in DCCBDECS(ERRORS)) used
by TSCODE to define the events are listed in Table 8-2. Events having an IOCB
associated with them are marked in the fourth column of the table.
Table 8-2. Events Detected With WAIT^EVENT
Event Description Literal Identifier
Literal
Constant
Associated
IOCB
No event: timeout occurred E^TIMEOUT 0
Request that task call STOP^TASK E^STOP 1
Resume processing E^CONTINUE 2
Intertask message or I/O canceled E^CAN 3 X
Message arrived from $RECEIVE E^IMSG 4 X
Intertask message arrived E^ITC 5 X