[ Predicate Database and Compiler | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]
Declares the procedure(s) specified by SpecList to be demons.
- Comma-separated sequence of expressions of the form Atom/Integer.
The demon annotation specifies that the listed predicates are to
be treated as demons. The only difference between a normal predicate
and a demon is the behaviour on waking: When a normal predicate is
delayed and gets woken, the delayed goal disappears. When a delayed
demon gets woken, the delayed goal stays around.
The only way to remove a demon is to explicitly kill it.
Modes and Determinism
This predicate is sensitive to its module context (tool predicate, see @/2).
- (4) instantiation fault
- SpecList is not instantiated.
- (5) type error
- SpecList is
instantiated, but not to a sequence of expressions of the form Atom/Integer.
- (62) inconsistent procedure redefinition
- Predicate in SpecList already defined and is not a demon
% A demon that wakes whenever X becomes more constrained
suspend(report(X, Susp), 1, X->constrained, Susp).
:- demon report/2.
report(X, _Susp) :-
writeln(constrained(X)). % implicitly re-suspend
report(X, Susp) :-
kill_suspension(Susp). % remove from the resolvent
[eclipse 1]: report(X),
X = X
[eclipse 2]: report(X),
X = 123
kill_suspension / 1, make_suspension / 3, notify_constrained / 1, schedule_suspensions / 2, set_suspension_data / 3, get_suspension_data / 3