The WAITANDRESET statement can be used as an arithmetic function that returns an integer value, starting at 1, that represents the position in the wait parameter list of the item that caused the program to be activated. For example, in the following statement the value of T is 1 if elapsed time caused the program to be activated:
T := WAITANDRESET((.001),E1,E2)
In the following statement the value of T is 2 if a cause operation on event E2 activated the program:
T := WAITANDRESET(E1,E2,E3)
This mechanism guarantees that one and only one parameter activates the program.
In the following statement, the value of T is 0 (zero) if a signal was received by the process before any of the events were caused:
T := WAITANDRESET [INTERRUPTIBLE] (E1,E2,E3)
The WAITANDRESET (<wait parameter list>) [<start index>] form is used to specify a round-robin or other sequence of testing. The arithmetic expression <start index> represents the position of the item in the <wait parameter list> that should be tested first. The index of the first item is one, the second is two, and so on. If the value of the <start index> is less than one or greater than the last item in the list, it is set to one. Note that if a (<time>) is specified in the wait parameter list, it is always tested first.
Note that the <direct array row> syntax is not allowed as a parameter to the WAITANDRESET statement.

