WAIT/POST facility

With the WAIT/POST facility, you direct a simulated resource to wait until an event is posted. As discussed in EVENT, events may be posted by the same terminal waiting on the event, by another terminal, or by the operator. The following example shows how to code the EVENT statement to post an event:
EVENT1  EVENT  POST=READY    Posts event READY.
The WAIT/POST facility involves WAIT and POST actions. For example, WSim can process a WAIT statement that specifies an event name during message generation or logic testing. After processing the statement, WSim cannot generate any further messages for that resource until the named event is posted. You can also cause a terminal to wait on an event by coding the EVENT operand on the WAIT message generation statement. When WSim processes this statement and operand, it does not generate any further messages for that terminal until the named event is posted.

At times, more than one terminal might be waiting on the same event or a single terminal might be waiting on multiple events. In fact, the meshing of events and terminals waiting on those events can be simulated in any combination you want.

Before a terminal can generate any further messages, all events on which it is waiting must be posted. When one event is posted, that terminal is no longer waiting on that event. After WSim posts all events that a terminal is waiting on, the wait is over, even if one event is reset before the others are posted.

After WSim posts an event, the event remains posted until explicitly reset. If WSim processes a WAIT statement when the named event is already posted, the terminal does not have to wait until the event is again posted. Note, however, that the WAIT statement still serves as a delimiter for message generation regardless of the completion of the event specified. If the event is already posted, the terminal can continue generating messages.

You can test for the completion of an event using a logic test. For example, test an event with an immediate logic test and then generate a message if the event is posted or issue a wait on that event if it is not posted.

WSim maintains ON conditions, that is, the condition of waiting on events to be signaled with an EVENT statement, independently from the standard conditions set by the WAIT indicators. For example, actions that turn off the WAIT indicator, such as taking a THEN=CONT action on a logic test, do not turn off the EVENT WAIT indicator. It must be turned off by posting the event. When WSim turns both of these indicators on, you must turn both off before WSim can generate additional messages. You can also enter commands from the console or use automatic terminal recovery to turn off the EVENT WAIT indicator and the WAIT indicator.

Note: You can use the A (Alter) operator command to post and reset named events in a network; see WSim User's Guide for more information about this command. For more information about the WAIT and WAIT EVENT indicators, see Interrupting message generation with unconditional delimiters.