Finished implementation for pending interrupts.
This commit is contained in:
parent
66c2ae5d38
commit
cad4096910
|
@ -60,10 +60,10 @@
|
|||
(interrupt-in-set? int *pending-interrupts*))
|
||||
|
||||
(define (make-interrupt-pending int)
|
||||
(insert-interrupt int *pending-interrupts*))
|
||||
(set! *pending-interrupts* (insert-interrupt int *pending-interrupts*)))
|
||||
|
||||
(define (remove-pending-interrupt int)
|
||||
(remove-interrupt int *pending-interrupts*))
|
||||
(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,13 +71,17 @@
|
|||
;;;
|
||||
;;; 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 *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))
|
||||
(call-interrupt-handler int))))
|
||||
(set! *enabled-interrupts* new-enabled-interrupts))
|
||||
(begin
|
||||
(remove-pending-interrupt int)
|
||||
(call-interrupt-handler int)))))))
|
||||
|
||||
(define-simple-syntax (with-enabled-interrupts interrupt-set body ...)
|
||||
(begin
|
||||
|
@ -200,7 +204,8 @@
|
|||
last full-interrupt-set))
|
||||
(interrupt ((structure-ref sigevents sigevent-type) event)))
|
||||
(if (interrupt-enabled? interrupt (enabled-interrupts))
|
||||
(call-interrupt-handler interrupt))
|
||||
(call-interrupt-handler interrupt)
|
||||
(make-interrupt-pending interrupt))
|
||||
(lp event))))
|
||||
|
||||
;;; I am ashamed to say the 33 below is completely bogus.
|
||||
|
|
Loading…
Reference in New Issue