[ Advanced Control and Suspensions | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

# trigger(+Trigger)

Wake the suspensions associated with the symbolic trigger Trigger until there are no more left.

Trigger
  An atom.

## Description

Suspensions in ECLiPSe go through several stages: They are created, attached to variables or symbolic triggers, later scheduled for execution, and finally executed.

The task of trigger/1 is to take suspensions from the global suspension list associated to the symbolic name Trigger and wake them. The suspensions are inserted into a global priority list, according to their individual priority, and then executed. Trigger/1 includes a call to wake/0 and is actually defined as

           trigger(Trigger) :-
    	   schedule_suspensions(Trigger),
    	   wake.

If no suspensions are associated to Trigger, trigger/1 just succeeds and does nothing.

### Fail Conditions

Fails if a woken goal fails

## Examples

    [eclipse 1]: suspend(writeln(world), 2, trigger(hello)), trigger(hello).
    world
    yes.

## See Also

demon / 1, attach_suspensions / 2, make_suspension / 3, suspend / 3