[ ECLiPSe event built-in|Group Index| Full Index]

event_after(+Even, +Time)

Set up an event Event which is triggered after Time seconds have elapsed.

+Event
Atom
+Time
Positive number

Description

The event Event is raised after Time seconds of elapsed time from when the predicate is executed. The same Event can be raised multiple times at different intervals with multiple calls to event_after/2 and event_after_every/2.

Time can be a real number, but the actual granularity of how fine the elapsed time is measured is operating system dependent, and the triggering condition is actually that at least Time seconds have elapsed. In addition, the processing of an event may not happen immediately upon the raising the event, as other event may also need to be processed at the same time.

To ensure the correct behaviour for timed events, the event handler for the event must not fail (or else it could cause some raised events to be not processed), and it should execute at priority 1 (so that it cannot be interupted).

The elapsed time is generally measured in elapsed user time, except for systems that cannot support this, such as Microsoft Windows. In this case, the time is measured in elapsed real time.

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(5) Type error
Event is not an atom or Time is not a positive number.

Examples


   setup :-
      set_event_handler(hi, hi/0),
      % set up event `hi' to occur once 3.2 seconds later
      % and the hi event will trigger the execution of hi/0.
      event_after(hi, 3.2).

   hi :-
      writeln(hi).


See Also

event_after_every / 2, cancel_after_event / 1, event / 1, set_event_handler / 2, current_after_event / 1