
set_suspension_data(+Susp, +Name, +Value)

   Modify properties of suspended goals.



Arguments
   Susp                A suspension or variable.
   Name                An atom.
   Value               An integer.

Type
   Advanced Control and Suspensions

Description
   This built-in is used to modify fields of the abstract suspension
   data type.  The modifiable properties of a suspension are:



Name        Type        Value
-------------------------------------------------------------
priority    Integer     Waking priority
invoc       Integer     Invocation number (debugging)

   All modifications are undone on backtracking. Changes to the priority
   only have an effect the next time the suspension is scheduled
   (ie changing the priority of an already scheduled suspension has
   no effect unless it is a demon which can become suspended again).
   If Susp is a variable or a dead suspension, this predicate
   silently succeeds, doing nothing.


   Note that a suspension is not a standard logical data structure and can
   only be manipulated in a restricted way.  In particular, a suspension
   cannot be printed (e.g. using writeq/1,2) and then read back, giving a
   term identical to the one that was printed.




Modes and Determinism
   set_suspension_data(+, +, +) is det

Exceptions
     4 --- Name or Value is not instantiated.
     5 --- Susp is instantiated, but not a suspension.
     5 --- Name is instantiated but not an atom.
     6 --- Name is not the name of a modifiable suspension property.

Examples
   
    [eclipse 1]: make_suspension(writeln(hello),5,S),
	    set_suspension_data(S, priority, 2),
	    get_suspension_data(S, priority, P).

    S = 'SUSP-_123-susp'
    P = 2
    Delayed goals:
	    writeln(hello)
    yes.


    :- demon d/2.
    d(X, Susp) :-
        ( var(S) ->        % initial suspend
	    suspend(d(X, Susp), 5, X->constrained, Susp)
	; finished(X) ->   % terminate
	    kill_suspension(Susp)
	; useful(X) ->     % raise priority
	    set_suspension_data(Susp, priority, 4)
	;                  % lower priority
	    set_suspension_data(Susp, priority, 6)
	).






See Also
   delayed_goals / 1, kill_suspension / 1, make_suspension / 3, get_suspension_data / 3, get_priority / 1, call_priority / 2, suspend / 3, suspensions / 1, current_suspension / 1, get_suspension_data / 3
