In the following example, if the happened state of event EVNT is TRUE (happened), the program continues with the next statement. Otherwise, the program is suspended until EVNT is caused, and the happened state of EVNT is set to FALSE (not happened).
WAITANDRESET(EVNT)
In the following example, if the happened state of event EVNT1, EVNT2, or the event designated by EVNTARAY[INDX] is TRUE (happened), the program continues with the next statement. Otherwise, the program is suspended until one of the three events is caused, and the happened state of that event is set to FALSE (not happened).
WAITANDRESET(EVNT1,EVNT2,EVNTARAY[INDX])
The following example is identical to the previous one except that the first event tested is determined by the value of START_EVENT:
WAIT(EVNT1,EVNT2,EVNTARAY[INDX]) [START_EVENT]
In the following example, if the happened state of event FINI or GOAWAY is TRUE (happened), the program continues with the next statement. Otherwise, the program is suspended until .5 second has elapsed or until event FINI or GOAWAY is caused. If FINI or GOAWAY is caused, its happened state is set to FALSE (not happened).
WAITANDRESET((.5),FINI,GOAWAY)
In the following example, if the happened state of event WAKEUP or LOOKAROUND is TRUE (happened), the program continues with the next statement. Otherwise, the program is suspended until SLEEPMAX seconds have elapsed or until event WAKEUP or LOOKAROUND is caused. The value stored in REASON is 1, 2, or 3, indicating which of the three items reactivated the program. If WAKEUP or LOOKAROUND is caused, its happened state is set to FALSE (not happened).
REASON := WAITANDRESET((SLEEPMAX),WAKEUP,LOOKAROUND)
In the following example, if the happened state of WAKEUP or GOAWAY is TRUE (happened), the program continues with the next statement. Otherwise, the program is suspended until NAPTIME seconds have elapsed or until either event WAKEUP or GOAWAY is caused, or the process receives a signal. If a signal is received before the WAKEUP or GOAWAY event is caused (happened), or before NAPTIME expires, the value stored in X is 0 (zero), indicating that the wait was interrupted by a signal.
X := WAITANDRESET [INTERRUPTIBLE] ((NAPTIME),WAKEUP,GOAWAY)

