| Prev | Next | Start of Chapter | Next Chapter | Contents | Glossary | Index | Comments | (25 out of 25)

wait

This statement suspends a procedure's execution, causing it to enter a wait state, until either a specified amount of time passes, a specified condition is met, or an event occurs. During this time, other processing may take place. For information about wait states see Allowing Other Processing. The syntax is:

where:


Specifies that G2 suspends procedure execution for the specified interval.

Specifies that G2 suspends procedure execution until a truth-value-expression is true. Note that the truth-value-expression may contain references to G2 variables and may data-seek for values.

Species how often G2 checks the value of the specified truth-value-expression. The time-expression is an expression that returns seconds.

The second until clause defines an event predicate. When you specify an event predicate in a wait statement, the statement suspends procedure execution until the event predicate becomes true. An event predicate may contain boolean operators. For example:

This form of the wait statement does not consume any CPU resources while it waits for an event to occur. If any of the items for which the event predicate awaits a value is deleted, the wait statement terminates, and control proceeds to the next statement.


Caution: When a procedure returns from a wait state, the environment in which it executes may have changed in ways that invalidate the procedure's assumptions. Be sure to revalidate the environment as needed before continuing execution of the procedure.

| Prev | Next | Start of Chapter | Next Chapter | Contents | Glossary | Index | Comments | (25 out of 25)

Copyright © 1997 Gensym Corporation, Inc.