The handler for the VM schedules now a event that will cause the
deliver thread to call the clients of low-interrupt. So the handler is short and save.
This commit is contained in:
parent
37fc37e78c
commit
e57f3608b8
|
@ -59,17 +59,41 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(define (init-low-interrupt)
|
(define (init-low-interrupt)
|
||||||
(set-interrupt-handler!
|
(spawn
|
||||||
(enum interrupt os-signal)
|
(lambda ()
|
||||||
(lambda (type arg enabled-interrupts)
|
(let ((I (current-thread)))
|
||||||
(call-handlers type enabled-interrupts)))
|
(set-interrupt-handler!
|
||||||
|
(enum interrupt os-signal)
|
||||||
(set-interrupt-handler!
|
(lambda (type arg enabled-interrupts)
|
||||||
(enum interrupt keyboard)
|
(schedule-event I
|
||||||
(lambda (enabled-interrupts)
|
(enum event-type interrupt)
|
||||||
(call-handlers (enum low-interrupt keyboard) enabled-interrupts)))
|
(enum interrupt os-signal)
|
||||||
|
type
|
||||||
|
enabled-interrupts)))
|
||||||
|
(set-interrupt-handler!
|
||||||
|
(enum interrupt keyboard)
|
||||||
|
(lambda (enabled-interrupts)
|
||||||
|
(schedule-event I
|
||||||
|
(enum event-type interrupt)
|
||||||
|
(enum interrupt keyboard)
|
||||||
|
enabled-interrupts)))
|
||||||
|
(let loop ()
|
||||||
|
(wait)
|
||||||
|
(call-with-values
|
||||||
|
get-next-event!
|
||||||
|
(lambda (event . data)
|
||||||
|
(if (eq? event (enum event-type interrupt))
|
||||||
|
(let ((i-nr (car data)))
|
||||||
|
(if (eq? i-nr (enum interrupt os-signal))
|
||||||
|
(call-handlers (cadr data) (caddr data))
|
||||||
|
(if (eq? i-nr (enum interrupt keyboard))
|
||||||
|
(call-handlers (enum low-interrupt keyboard)
|
||||||
|
(cadr data))))))))
|
||||||
|
(loop))))
|
||||||
|
'low-interrupt-deliver-thread)
|
||||||
|
|
||||||
(call-after-gc!
|
(call-after-gc!
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let ((enabled-interrupts "JMG: enabled interrupts not yet impl"))
|
(let ((enabled-interrupts "JMG: enabled interrupts not yet impl"))
|
||||||
|
@ -83,11 +107,9 @@
|
||||||
(define interrupt-deliver-lock (make-lock))
|
(define interrupt-deliver-lock (make-lock))
|
||||||
|
|
||||||
(define (call-handlers low-interrupt enabled-interrupts)
|
(define (call-handlers low-interrupt enabled-interrupts)
|
||||||
(obtain-lock interrupt-deliver-lock)
|
|
||||||
(for-each (lambda (handler-lock-pair)
|
(for-each (lambda (handler-lock-pair)
|
||||||
((car handler-lock-pair) enabled-interrupts))
|
((car handler-lock-pair) enabled-interrupts))
|
||||||
(low-interrupt-handler-ref low-interrupt))
|
(low-interrupt-handler-ref low-interrupt)))
|
||||||
(release-lock interrupt-deliver-lock))
|
|
||||||
|
|
||||||
|
|
||||||
;;; the vm uses the timer for the scheduler
|
;;; the vm uses the timer for the scheduler
|
||||||
|
|
Loading…
Reference in New Issue