Re: Interrupt handlers are not called

Robert Ransom <[email protected]> Fri, 6 Nov 2009 16:03:29 -0800
Newsgroups gmane.lisp.scheme.scheme48
Message-ID <20091106160329.76ea5186@neutron>
On Fri, 6 Nov 2009 15:03:31 -0500
Roderic Morris <[email protected]> wrote:

> I'm trying to use the interrupts package's set-interrupt-handler! to
> catch interrupts of type os-signal. The handler I set seems to never
> be called though. If i send a sigchld to the scheme48 process, nothing
> happens, and if i send something more exotic like sigpwr on linux, it
> actually dies.
> 
> Interrupt handlers seem to work as expected in the scheme48 bundled
> with scsh 0.6.7 (or else they changed it to work). It may be the case
> that the package's usage has changed, but there doesn't seem to be any
> documentation for it, so I can't tell. Should something like this
> work?
> 
> (set-interrupt-handler! (enum interrupt os-signal)
>                         (lambda (type enabled-interrupts)
>                           (display type) (newline)
>                           (display enabled-interrupts) (newline)))
> 
> -Roderic
> 

Use the posix-processes structure instead.

If you want to find out how set-interrupt-handler! is used to handle
signals, read scheme/posix/signal.scm, but keep in mind that all of the
VM's interrupts are used by the RTS, and setting a handler will likely
break everything that depends on the usual handler being called.

Robert Ransom