WAIT Parameter List

When only one event appears in a statement of the form WAIT(<event list>), the event is examined to determine whether its happened state is TRUE (happened) or FALSE (not happened). If the happened state of the event is TRUE, the program continues executing with the next statement. If the happened state of the event is FALSE, the program is suspended until the event is caused.

Generally, an imported event or IMPORTED EVENT ARRAY element cannot be used as an event designator in an event list. However, an IMPORTED EVENT that is declared in a CONNECTION BLOCK can be used as an event designator if the compiler control option WAITIMPORT is set.

When a statement of the form WAIT((<time>)) is executed, execution of the program is suspended for <time> seconds. Refer to the WHEN Statement for a discussion of <time>.

When the statement includes an event list in the wait parameter list, the program is suspended until any one event in the event list is caused or until <time> seconds, if specified, have elapsed.

The WAIT(<wait parameter list>) form 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 := WAIT((.001),E1,E2)

In the following statement the value of T is 2 if a cause operation on event E2 activated the program:

T := WAIT(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 := WAIT [INTERRUPTIBLE] (E1,E2,E3)

When STOQ_INPUT is specified the program is suspended until a STOQUE entry is available. When STOQ_OUTPUT is specified the program is suspended until space is available for storage of data. The storage queue identifier specifies the appropriate STOQUE parameter block.

When CRCR_INPUT is specified the program is suspended until the sending program is ready to send the data. When CRCR_OUTPUT is specified the program is suspended until the receiving program is ready to receive the data. The core-to-core program name specifies the name of the program subject to the receive and send by way of core-to-core communication. It is a file title ended by a period or the null character.

The WAIT statement with a wait parameter list and the WAITANDRESET statement are identical, except for the state to which the caused event is set during the cause process. If a program is waiting on an event because of the WAIT statement, then the happened state of the event is set to TRUE (happened). If a program is waiting on an event because of a WAITANDRESET statement, then the happened state of the event is set to FALSE (not happened).