Fixed up the sighandler code some.
This commit is contained in:
parent
cfdc457e2a
commit
5761b6ce03
|
@ -95,18 +95,27 @@
|
|||
;;; continuation), the ENABLED-INTERRUPTS register will be restored to its
|
||||
;;; previous value.
|
||||
|
||||
;;; This handler does nothing -- used when the handler is #f.
|
||||
(define (noop-sig-handler enabled-interrupts) #f)
|
||||
|
||||
(define (set-signal-handler! sig handler)
|
||||
(let ((nhandler (if (eq? handler #t) ; Get SIG's default handler.
|
||||
(vector-ref default-handler-vec sig)
|
||||
handler))
|
||||
(let ((nhandler (case handler
|
||||
((#t) (vector-ref default-handler-vec sig))
|
||||
((#f) noop-sig-handler)
|
||||
(else handler)))
|
||||
(int (signal->interrupt sig)))
|
||||
(with-enabled-interrupts 0
|
||||
(let ((ohandler (vector-ref interrupt-handlers int)))
|
||||
(vector-set! interrupt-handlers int nhandler)
|
||||
ohandler))))
|
||||
(cond ((eq? ohandler (vector-ref default-handler-vec sig)) #t)
|
||||
((eq? ohandler noop-sig-handler) #f)
|
||||
(else ohandler))))))
|
||||
|
||||
(define (signal-handler sig)
|
||||
(vector-ref interrupt-handlers (signal->interrupt sig)))
|
||||
(let ((handler (vector-ref interrupt-handlers (signal->interrupt sig))))
|
||||
(cond ((eq? handler (vector-ref default-handler-vec sig)) #t)
|
||||
((eq? handler noop-sig-handler) #f)
|
||||
(else handler))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; Set the Unix signal handler. One doesn't usually use this; one usually
|
||||
|
|
Loading…
Reference in New Issue