I was searching for a way to define signal handlers. I found a description here:
https://mercure.iro.umontreal.ca/pipermail/gambit-list/2006-January/000529.h...
which is also in examples/misc/signals.scm. It works by calling
___EXT(___raise_interrupt) (___INTR_6);
in the C signal handler and registering an corresponding function in Scheme:
(##interrupt-vector-set! 6 (lambda () (println 'got-SIGUSR1)))
Is this still the preferred way to install signal handlers?
And if so how are the numbers chosen for the call to ##interrupt-vector-set!?
I found the definition in lib/_kernel.scm:
(define ##interrupt-vector (##vector #f #f #f #f #f #f #f #f))
(define-prim (##interrupt-vector-set! code handler) (##declare (not interrupts-enabled)) (##vector-set! ##interrupt-vector code handler))
It seems to me that 7 is the last interrupt one can use. If I use 6 and 7 for USR1 and USR2 how can I set a handler for SIGHUP, SIGTERM, SIGQUIT, SIGPWR and SIGIO?
Afficher les réponses par date