The library(time) provides timing and alarm functions. Alarms are
thread-specific, i.e., creating an alarm causes the alarm goal to be
called in the thread that created it. The predicate current_alarm/4 only
reports alarms that are related to the calling thread. If a thread
terminates, all remaining alarms are silently removed. Most applications
- alarm(+Time, :Callable, -Id) is det
- alarm(+Time, :Callable, -Id, +Options) is det
- Set up an alarm to be signaled Time seconds from now. If the
alarm expires, Callable is called asynchronously. Callable can
be used to raise an exception using throw/1 to abort some
Options is a list of Name(Value) options. Currently defined
false), remove the alarm-event (as
remove_alarm/1) after it has been fired.
true) do not install the alarm.
It must be installed separately using install_alarm/1.
- alarm_at(+Time, :Callable, -Id) is det
- alarm_at(+Time, :Callable, -Id, +Options) is det
- As alarm/3 and alarm/4, but schedule the alarm at an absolute
point in time.
- See also
- - date_time_stamp/2.
- install_alarm(+Id) is det
- install_alarm(+Id, +RelTime) is det
- Install an alarm allocated using alarm/4 with the
option or de-activated using uninstall_alarm/1. With a given
RelTime, the alarm is scheduled at the RelTime from now.
Otherwise it is scheduled on the same (absolute) time on which
is was created.
- uninstall_alarm(+Id) is det
- De-activate an alarm. This does not invalidate Id, but ensures
that the alarm will not fire. The alarm can be rescheduled to
the original time using install_alarm/1 or to a new time using
- remove_alarm(+Id) is det
- Remove an alarm. If it has not yet been fired, it never will.
- current_alarm(?Time, :Goal, ?Id, ?Status) is nondet
- Enumerate the alarms in the schedule. Time is the absolute time
the event is scheduled for (see also get_time/1). Goal is the
goal to execute, Id is the identifier and Status is the
scheduling status. It takes the value
done if the alarm has
next if the event is the next to be executed and
- call_with_time_limit(+Time, :Goal) is det
- call_with_time_limit(+Time, :Goal, +Context) is det
- Call Goal, while watching out for a (wall-time) limit. If this limit
is exceeded, the exception
time_limit_exceeded is raised.
time_limit_exceeded(Context). Goal is
called as in once/1.
time_limit_exceeded (call_with_time_limit/2) or
The following predicates are exported, but not or incorrectly documented.
- call_with_time_limit(Arg1, Arg2, Arg3)
- install_alarm(Arg1, Arg2)
- alarm(Arg1, Arg2, Arg3, Arg4)
- alarm_at(Arg1, Arg2, Arg3, Arg4)