Next: Role
Up: Events
Previous: Event Handler
Predicate wait-for/1 can be used by the current thread
to wait for some event to occur.
In previous releases of COCA, when a message was expected from
a certain object, we needed an active rule to
wait for it.
This new construct can make it simpler and clearer.
For example, when a message is sent to an object and
an answer is expected from it, we simply specify the following.
A second argument can be added to wait-for which specifies
the timeout period before wait-for/2 can be failed.
Any nonnegative number is valid or the symbol ``''
can be used to denote infinity.
If it is an unbound variable, when the predicate succeeds
this variable is bound to the length of time from when the
wait-for was executed until the event occurred.
Du Li
8/25/1999