The wait is associated with a module. This module is derived from the Options argument.
The Options list specifies when Goal is re-evaluated and optionally when the call terminates due to a timeout.
- Timeout and deadline handling. See thread_get_message/3 for details. This predicate fails when it terminates due to one of these options.
- Retry goal every Time seconds regardless of whether an event happened. The default is 1 second. This ensures that signals (see thread_signal/2) and time limits are respected with an optional delay.198Some operating systems process such signals immediately, while others only check for such events synchronously.
- Wakeup on arbitrary changes to any dynamic predicate that is defined in
the associated module. This is the default if
wait_preds(+Preds)is not provided.
- Only call Goal if at least one of the predicates in
List has been modified. Each element of List is a predicate
indicator (Name/Arity or
Name//Arity that is resolved to a predicate in the module this
wait is associated with. If the element is
+p/1is read as /(+(p),1)., Goal is only triggered if a clause was added (assert/1). If the element is
, Goal is only triggered if a clause was retracted (retract/1 or erase/1). Default is to wakeup on both assert and retract.
- The List variable normally also appears in Goal
and is unified with a list of predicates from the
wait_predsoption that have been modified. List must be unbound at entry.
- Specifies the module to act on explicitly.
The execution of Goal is synchronized between all threads calling this predicate on the same module, changes to dynamic predicates in this module and calls to thread_update/2 on the same module.
This predicate raises a
permision_error exception when
called recursively or called from inside a transaction. See
section 184.108.40.206 for
details about interaction with transactions.