[ Advanced Control and Suspensions | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]
Execute Goal with priority Priority.
- Atom or compound term.
- A small integer.
All goals in ECLiPSe execute under a certain priority. An execution
can only be interrupted by the waking of a goal with a higher
priority. Priorities are most relevant in data-driven algorithms,
to specify that certain goals must do their work before others
can meaningfully execute.
Priorities range from 1 (most urgent) to 12 (least urgent). The
toplevel goal of an execution always runs at the lowest priority (12).
call_priority/2 runs a goal at a given priority. If this priority
is higher than the one under which call_priority was invoked,
the goal executes immediately, but will be less interruptable
by woken goals. If the specified priority is lower, the execution
of goal will be effectively deferred until there are no more urgent
Warning: Although it is possible to write programs that only work
correctly under a particular priority ordering, such practice is
strongly discouraged. Priorities should only affect efficiency,
This predicate is sensitive to its module context (tool predicate, see @/1).
Fails if Goal fails
Resatisfiable if Goal is resatisfiable
- (4) instantiation fault
- Goal or Priority is not instantiated.
- (5) type error
- Goal is not an atom or a compound term, or Priority is not an integer.
- (24) number expected
- Priority is not a number.
[eclipse 1]: [user].
p :- call_priority(writeln(hello),8), writeln(world).
user compiled traceable 136 bytes in 0.00 seconds
[eclipse 10]: call_priority(p,5).
[eclipse 11]: call_priority(p,10).
[eclipse 12]: call_priority(p,8).
get_priority / 1, make_suspension / 3, make_suspension / 4, suspend / 3, suspend / 4, set_suspension_data / 3