[ Event Handling | Reference Manual | Alphabetic Index ]

events_after(++Events)

Set up a series of after events Events.
Events
A list of the form Event-Time or Event-every(Time)

Description

Events is a list of after events where each element of the list specifies one after event. Each element is either in the form of EventName-Time or EventName-every(Time) where the first form is equivalent to event_after(EventName, Time) and the second to event_after_every(EventName, Time). The difference between using a single events_after/1 and multiple calls to event_after/2, event_after/3 and event_after_every/2 to set up a series of after events is that with events_after/1, all the events are set up as a unit, and it is guaranteed that the relative orderings between the events are preserved, and that no after events will be raised until all the specified events have been set up.

The main use of events_after/1 is for restart event that have been cancelled previously with cancel_after_event/2.

See event_after/2, event_after/3 or event_after_every/2 for more details on after events.

Modes and Determinism

Exceptions

(4) instantiation fault
Events is not instantiated.
(5) type error
Events is not a list of after events of the form Event-Time or Event-every(Time), where Event is an atom or a handle and Time is a positive (non-breal) number.

Examples

    % set event handlers to write the event name
    ?- set_event_handler(e1, writeln/1),
    	set_event_handler(e2, writeln/1).
    Yes (0.00s cpu)

    ?- events_after([e1-every(0.2), e2-0.5]),
    	repeat,fail.
    e1
    e1
    e2
    e1
    e1
    e1
    ^C
    interruption: type a, b, c, e, or h for help : ? a
    abort
    Aborting execution ...
    Abort

    % cancel further e1 events
    ?- cancel_after_event(e1, Cancelled).
    Cancelled = [e1 - every(0.2)]
    Yes (0.00s cpu)

    % e2 was already raised, nothing to cancel
    ?- cancel_after_event(e2, Cancelled).
    Cancelled = []
    Yes (0.00s cpu)

    % restart the cancelled events
    ?- events_after([e1 - every(0.2)]),
	    repeat, fail.
    e1
    e1
    e1
    e1
    ...

See Also

event_after / 2, event_after / 3, event_after_every / 2, cancel_after_event / 2, events_after / 1, event / 1, set_event_handler / 2, current_after_events / 1, event_create / 3, event_retrieve / 3, get_flag / 2