>>>>> "RT" == RT Happe <rthappe@mathematik.uni-freiburg.de> writes:
RT> Thanks for the quick patch. However, now scsh ignores pending interrupts
RT> after control leaves the protected block. I changed the script for better
RT> demonstration:
RT> #!/tmp/bin/scsh \
RT> -o low-interrupt -s
RT> !#
RT> ; the struct LOW-INTERRUPT serves the proc REMOVE-INTERRUPT
RT> (display (with-enabled-interrupts
RT> (remove-interrupt interrupt/tstp (enabled-interrupts))
RT> (read)))
RT> (newline)
RT> ; eof
RT> When I type ``anton^Ziter'' and enter, the script isn't suspended during
RT> the READ, fine, but neither before the DISPLAY. It simply displays
RT> ``iter'' and finishes.
Right. At second glance I have to admit that the code for handling
pending interrupts wasn't finished yet. I obviously ceased working on
it some day and forgot about it. The appended patch should fix
this. Your script will still print only ``iter'' but I blame the
shell/tty for this:
> 1^Z
Suspended
[1 gasbichl@aubisque scsh-0.6] fg
./go
2
2
Sending TSTP via kill(1) works as expected.
Thanks for the detailed report!
Index: sighandlers.scm
===================================================================
RCS file: /cvsroot/scsh/scsh-0.6/scsh/sighandlers.scm,v
retrieving revision 1.25
diff -u -c -r1.25 sighandlers.scm
*** sighandlers.scm 18 Jul 2002 08:04:34 -0000 1.25
--- sighandlers.scm 5 Aug 2002 11:19:09 -0000
***************
*** 60,69 ****
(interrupt-in-set? int *pending-interrupts*))
(define (make-interrupt-pending int)
! (insert-interrupt int *pending-interrupts*))
(define (remove-pending-interrupt int)
! (remove-interrupt int *pending-interrupts*))
;;; I'm trying to be consistent about the ! suffix -- I don't use it
;;; when frobbing process state. This is not a great rule; perhaps I
--- 60,69 ----
(interrupt-in-set? int *pending-interrupts*))
(define (make-interrupt-pending int)
! (set! *pending-interrupts* (insert-interrupt int *pending-interrupts*)))
(define (remove-pending-interrupt int)
! (set! *pending-interrupts* (remove-interrupt int *pending-interrupts*)))
;;; I'm trying to be consistent about the ! suffix -- I don't use it
;;; when frobbing process state. This is not a great rule; perhaps I
***************
*** 71,83 ****
;;;
;;; I think you should...
(define (set-enabled-interrupts new-enabled-interrupts)
! (do ((int 0 (+ int 1)))
! ((= int number-of-interrupts) new-enabled-interrupts)
! (let ((old-state (interrupt-enabled? int *enabled-interrupts*))
! (new-state (interrupt-enabled? int new-enabled-interrupts)))
! (if (and (not old-state) new-state (interrupt-pending? int))
! (call-interrupt-handler int))))
! (set! *enabled-interrupts* new-enabled-interrupts))
(define-simple-syntax (with-enabled-interrupts interrupt-set body ...)
(begin
--- 71,87 ----
;;;
;;; I think you should...
(define (set-enabled-interrupts new-enabled-interrupts)
! (let ((old-enabled-interrupts *enabled-interrupts*))
! ;;; set it here so the handlers see the correct value
! (set! *enabled-interrupts* new-enabled-interrupts)
! (do ((int 0 (+ int 1)))
! ((= int number-of-interrupts) new-enabled-interrupts)
! (let ((old-state (interrupt-enabled? int old-enabled-interrupts))
! (new-state (interrupt-enabled? int new-enabled-interrupts)))
! (if (and (not old-state) new-state (interrupt-pending? int))
! (begin
! (remove-pending-interrupt int)
! (call-interrupt-handler int)))))))
(define-simple-syntax (with-enabled-interrupts interrupt-set body ...)
(begin
***************
*** 200,206 ****
last full-interrupt-set))
(interrupt ((structure-ref sigevents sigevent-type) event)))
(if (interrupt-enabled? interrupt (enabled-interrupts))
! (call-interrupt-handler interrupt))
(lp event))))
;;; I am ashamed to say the 33 below is completely bogus.
--- 204,211 ----
last full-interrupt-set))
(interrupt ((structure-ref sigevents sigevent-type) event)))
(if (interrupt-enabled? interrupt (enabled-interrupts))
! (call-interrupt-handler interrupt)
! (make-interrupt-pending interrupt))
(lp event))))
;;; I am ashamed to say the 33 below is completely bogus.
--
Martin
|