WAIT Instruction
This instruction will wait for specified objects to reach a stable state and then terminates.
Syntax
wait (
where 'elemi' is either
object-name
or
- all_in
set-name
NB: For more advanced use for experts see Variable Elements in SML
Example:
wait ( A, all_in B, C )
where A and C are object names and B is an object set name
Description
In the following we consider an object to be in either of the two types of states:
- available - an object is neither busy (i.e. it is not executing an action), nor there are any actions queued on its internal action queue.
- not-available - an object is either busy, or there are actions queued on its internal action queue.
The wait instruction is 'synchronising' instruction. It takes as parameters a list of objects and/or list of object sets and it will behave as follows:
- if all the listed objects and also the objects included in the listed object sets are available (see above), it will terminate and the execution of the current action proceeds with the instruction that follows the wait instruction. or
- if any of the listed objects or any of the objects included in the
listed object sets is not-available (see above), it will
- 'lock' all the available objects. Once an object is 'locked', it will not commence an execution of any action.
- for not-available objects, it will queue 'lock action' on their internal action queues. This action will be eventually executed and will have the effect of 'locking' its object.
- suspend its (wait) execution and consequently the execution of the action that is executing the wait instruction.
The execution of the wait instruction is resumed as soon as all the objects are locked. At that point all the objects are again released ('unlocked') and the wait instruction terminates.