Next: , Previous: , Up: The Language   [Contents][Index]

4.4 Interrupts

Function: ticks n

Returns the number of ticks remaining till the next tick interrupt. Ticks are an arbitrary unit of evaluation. Ticks can vary greatly in the amount of time they represent.

If n is 0, any ticks request is canceled. Otherwise a ticks-interrupt will be signaled n from the current time. ticks is supported if SCM is compiled with the ticks flag defined.

Callback procedure: ticks-interrupt

Establishes a response for tick interrupts. Another tick interrupt will not occur unless ticks is called again. Program execution will resume if the handler returns. This procedure should (abort) or some other action which does not return if it does not want processing to continue.

Function: alarm secs

Returns the number of seconds remaining till the next alarm interrupt. If secs is 0, any alarm request is canceled. Otherwise an alarm-interrupt will be signaled secs from the current time. ALARM is not supported on all systems.

Function: milli-alarm millisecs interval
Function: virtual-alarm millisecs interval
Function: profile-alarm millisecs interval

milli-alarm is similar to alarm, except that the first argument millisecs, and the return value are measured in milliseconds rather than seconds. If the optional argument interval is supplied then alarm interrupts will be scheduled every interval milliseconds until turned off by a call to milli-alarm or alarm.

virtual-alarm and profile-alarm are similar. virtual-alarm decrements process execution time rather than real time, and causes SIGVTALRM to be signaled. profile-alarm decrements both process execution time and system execution time on behalf of the process, and causes SIGPROF to be signaled.

milli-alarm, virtual-alarm, and profile-alarm are supported only on systems providing the setitimer system call.

Callback procedure: user-interrupt
Callback procedure: alarm-interrupt
Callback procedure: virtual-alarm-interrupt
Callback procedure: profile-alarm-interrupt

Establishes a response for SIGINT (control-C interrupt) and SIGALRM, SIGVTALRM, and SIGPROF interrupts. Program execution will resume if the handler returns. This procedure should (abort) or some other action which does not return if it does not want processing to continue after it returns.

Interrupt handlers are disabled during execution system and ed procedures.

To unestablish a response for an interrupt set the handler symbol to #f. For instance, (set! user-interrupt #f).

Callback procedure: out-of-storage
Callback procedure: could-not-open
Callback procedure: end-of-program
Callback procedure: hang-up
Callback procedure: arithmetic-error

Establishes a response for storage allocation error, file opening error, end of program, SIGHUP (hang up interrupt) and arithmetic errors respectively. This procedure should (abort) or some other action which does not return if it does not want the default error message to also be displayed. If no procedure is defined for hang-up then end-of-program (if defined) will be called.

To unestablish a response for an error set the handler symbol to #f. For instance, (set! could-not-open #f).


Next: , Previous: , Up: The Language   [Contents][Index]