[ ECLiPSe Event built-in.|Group Index| Full Index]

set_interrupt_handler(+Number, +PredSpec)

Sets an interrupt handler PredSpec for the interrupt with number Number.

+Number
Integer.
+PredSpec
Term of the form Atom/Integer.

Description

Assigns the procedure specified by PredSpec as the interrupt handler for the interrupt whose number is given by Number.

See the ECLiPSe User Manual [?] for details on the operation of interrupt handlers.

The interrupt handlers of the following interrupts cannot be modified, since they cannot be caught by ECLiPSe .

    No. Code     Description  Example
    9   SIGKILL  kill         kill process from keyboard
    17  SIGSTOP  stop         cannot be caught, blocked, ignored
The following interrupt handlers have a special meaning:

    Handler   Meaning
    true/0    ignore the interrupt.
    default/0 take the standard UNIX action when the
              interrupt occurs (ECLiPSe does not catch it).
    event/1   handle the signal by posting a (synchronous) event. The
              symbolic name of the interrupt will be used as the event name.
The interrupts which can be caught or trapped are implementation defined.

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(4) Instantiation fault
Either Number or PredSpec is not instantiated.
(5) Type error
Number is not an integer.
(5) Type error
PredSpec is neither a variable nor of the form Atom/Integer.
(6) Range error
Number is not a valid error number.
(6) Range error
PredSpec is of the form Atom/Integer, but the integer is greater than 3.
(60)
PredSpec is of the form Atom/Integer, but no such predicate has been defined.
(170)
The interrupt cannot be caught.

Examples


Success:
    [eclipse]: get_interrupt_handler(14,M,N).
    M = it_handler / 1
    N = sepia_kernel
    yes.
    [eclipse]: set_interrupt_handler(14,true/0), interrupt(14),
    > get_interrupt_handler(14,true/0,sepia_kernel).
    yes.

    [eclipse]: [user].
     a :- write(toplevel_output, "interrupt 16"), fail.
     user compiled 136 bytes in 0.00 seconds
    [eclipse]: set_interrupt_handler(16,a/0).
    yes.
    [eclipse]: interrupt(16).
    interrupt 16
    yes.

Error:
    set_interrupt_handler(N,true/0).    (Error 4).
    set_interrupt_handler(15,P).        (Error 4).
    set_interrupt_handler(15.0,true/0). (Error 5).
    set_interrupt_handler(1000,X).      (Error 6).
    set_interrupt_handler(-1,X).        (Error 6).
    set_interrupt_handler(6,a/4).       (Error 6).  % arity > 3.
    set_interrupt_handler(6,t/2).       (Error 60). % no t/2.
    set_interrupt_handler(9,true/0).    (Error 170).
    set_interrupt_handler(17,true/0).   (Error 170).

See Also

event / 1, set_event_handler / 2, current_interrupt / 2, reset_interrupt_handler / 1, get_interrupt_handler / 3