[ Advanced Control and Suspensions | Reference Manual | Alphabetic Index ]

# make_suspension(+Goal, +Prio, -Susp)

Make Goal a suspended goal

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.

A suspension can be in three states:

    	State		Printed as
    	---------------------------------
    	sleeping	'SUSP-_123-susp'
    	scheduled	'SUSP-_123-sched'
    	dead		'SUSP-_123-dead'

The Prio argument determines the priority with which the Goal will be scheduled when woken. It can be a positive number between 1 and 12, or zero, in which case the priority defaults to the priority setting of the predicate which is called in Goal.

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 an atom although it gets printed by default in the form 'SUSP-_123-susp'. The only way to create a suspension is with make_suspension/3,4, suspend/3,4 or by copying an existing suspension. The contents of a suspension can only be retrieved using get_suspension_data/3.

### Modes and Determinism

- make_suspension(+, +, -) is det

### Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

### Exceptions

(4) instantiation fault
  Goal is not instantiated.
(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) out of range
  Prio is not a valid priority.
(60) referring to an undefined procedure
  Goal refers to an undefined precedure.

## Examples

    [eclipse 1]: make_suspension(writeln(hello), 1, S), suspensions(Ss).

    S = 'SUSP-_264-susp'
    Ss = ['SUSP-_264-susp']

    Delayed goals:
    	writeln(hello)
    Yes (0.00s cpu)

    [eclipse 2]: make_suspension(true, 3, S), is_suspension(S), type_of(S,T).

    S = 'SUSP-_272-susp'
    T = goal

    Delayed goals:
            true
    Yes (0.00s cpu)

## See Also

suspend / 3, delayed_goals / 1, insert_suspension / 4, is_suspension / 1, kill_suspension / 1, schedule_suspensions / 1, schedule_suspensions / 2, get_suspension_data / 3, set_flag / 3, wake / 0