waitforend
waitforend |
Purpose
Wait for the end of execution of a model.
Synopsis
procedure waitforend(mo:Model)
procedure waitforend(mo:Model,dur:integer)
Arguments
mo
|
A model
|
dur
|
A duration in seconds, the constant
WAIT_INFINITE or a timer identifier as a negative integer
|
Further information
1. This procedure suspends the execution of the caller until a given model has terminated its execution. The second form specifies a time limit: the processing is suspended for at most
dur seconds, the special value
WAIT_INFINITE is interpreted as an infinite duration.
2. Before the procedure returns all events received from the model to monitor are removed from the event queue (including the
EVENT_END event) unless the time limit has been reached. In this case some of the events of the submodel may have been removed from the event queue.
3. If the time limit is
0 the execution is not suspended but the queue of events is processed once and a subsequent call to
waitexpired will return
true if the model was still running when the procedure was called (the event queue is not modified in this case).
4. The parameter
dur may also take a negative value: in this case it is interpreted as the opposite of a timer identifier (see
settimer) and the function will wait until this timer expires if no valid event arrives. When the routine interrupts its monitoring due to the expiration of a timer the first event in the queue is the event
EVENT_TIMER associated to this timer. Note that if no timer corresponds to the given value the routine will terminate only when an expected event is available as if
WAIT_INFINITE had been used.
Related topics
Module