[ Event Handling | Reference Manual | Alphabetic Index ]

# current_after_events(-Events)

Check or find currently pending after events.

Events
  List of due / 2 structures or variable

## Description

If Events is a variable, then all the currently pending events are returned as a list. The list elements are of the form due(EventName - PostTime, DueTime) for an event raised with event_after/2 and event_after/3 and of the form due(EventName - every(Interval), NextDueTime) for an event raised with event_after_every/2. An event will appear as many times as it has been setup. EventName is the name of the after event. PostTime is the time at which the event was posted, and DueTime the time at which it is to be raised. For a repeating after event, Interval is the period between events, and NextDueTime is the next time at which it is to be raised.

Note that this predicate simply returns a snapshot of the current pending after events. It is therefore possible that an after event returned in Events has already been raised.

### Modes and Determinism

- current_after_events(-) is det

## Examples

       setup :-
          set_event_handler(hi, hi/0),
          event_after_every(hi, 3.2).

       hi :-
          current_after_events(Es),
          writeln(hi),
          writeln('Pending events'-Es).

       % just spinning after the setup for events to be raised.
       ?- setup, repeat, fail.
        hi
        Pending events - [due(hi - every(3.2), 30.51)]
        hi
        Pending events - [due(hi - every(3.2), 33.72)]
        hi
        Pending events - [due(hi - every(3.2), 36.93)]
        ...

## See Also

event_after / 2, event_after / 3, event_after_every / 2, event / 1, set_event_handler / 2, event_create / 3, event_retrieve / 3