[ ECLiPSe Operating System built-in.|Group Index| Full Index]

set_timer(+Timer, +Interval)

Start (or stop) the specified Timer to send signals in intervals of Interval seconds.

+Timer
One of the atoms real, virtual or profile.
+Interval
Number (Integer or Real)

Description

Used to initialise one of the 3 operating system's interval timers. After a call to this predicate, the corresponding timer will start sending signals to the ECLiPSe process every Interval seconds. Every call will change the previous interval of the specified timer. A timer is switched off by setting its Interval to 0.

                             -----------------
                             |Timer   |Signal |
                             -----------------
                             |real    |alrm   |
                             |virtual |vtalrm |
                             |profile |prof   |
                             -----------------

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(4) Instantiation fault
Timer orInterval is not instantiated.
(5) Type error
Timer is not an atom.
(5) Type error
Interval is not integer or real.
(6) Range error
Timer is an atom not naming a timer.
(170)
Interval is an out of range timer interval.

Examples


[eclipse]: [user].
 handler(N) :-
        getval(count, Count),
        writeln(signal(N)-Count),
        ( Count > 0 ->
                decval(count)
        ;
                set_timer(real, 0)      % switch off the timer
        ).

 :- set_interrupt_handler(alrm, handler/1).
 user       compiled traceable 372 bytes in 0.00 seconds

yes.
[eclipse]: setval(count, 4), set_timer(real, 0.5).

yes.
[eclipse]: signal(14) - 4
signal(14) - 3
signal(14) - 2
signal(14) - 1
signal(14) - 0


See Also

alarm / 1, current_interrupt / 2, get_timer / 2, sleep / 1, set_interrupt_handler / 2