[ ECLiPSe Control built-in.|Group Index| Full Index]

make_suspension(+Goal, +Prio, -Susp)

Make Goal a suspended goal with waking priority Prio and return the corresponding suspension object in Susp.

+Goal
A Prolog Goal.
+Prio
A small integer.
-Susp
A variable.

Description

The goal Goal is made a suspended goal, i.e. it enters the suspended part of the resolvent and shows up as a delayed goal. When the debugger is on, a DELAY port is generated.

Note that a suspension is not a standard Prolog data structure and can only be manipulated in a restricted way. In particular, a suspension is not a term with functor 'GOAL' or 'WOKEN GOAL' although it is printed this way by default. The only way to create a suspension is with make_suspension/2 or by copying an existing suspension.

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(5) Type error
Goal is not a callable term.
(5) Type error
Susp is not a variable.
(5) Type error
Prio is not an integer.
(6) Range error
Prio is not a valid priority.
(60)
Goal refers to an undefined precedure.

Examples


[eclipse 1]: make_suspension(writeln(hello), 1, S),
     delayed_goals(G).

S = 'GOAL'(writeln(hello), eclipse)
G = [writeln(hello)]

Delayed goals:
writeln(hello)
yes.
[eclipse 2]: make_suspension(true, 3, S),
             atomic(S), type_of(S,T).

S = 'GOAL'(true, eclipse)  % although printed like a structure,
T = goal                   % a suspension has atomic type 'goal'

Delayed goals:
true
yes.


See Also

delayed_goals / 1, insert_suspension / 4, is_suspension / 1, kill_suspension / 1, schedule_suspensions / 1, schedule_suspensions / 2, suspension_to_goal / 3, wake / 0