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:
marting 2000-07-27 13:33:51 +00:00
parent 37fc37e78c
commit e57f3608b8
1 changed files with 35 additions and 13 deletions

View File

@ -59,17 +59,41 @@
(define (init-low-interrupt)
(set-interrupt-handler!
(enum interrupt os-signal)
(lambda (type arg enabled-interrupts)
(call-handlers type enabled-interrupts)))
(set-interrupt-handler!
(enum interrupt keyboard)
(lambda (enabled-interrupts)
(call-handlers (enum low-interrupt keyboard) enabled-interrupts)))
(spawn
(lambda ()
(let ((I (current-thread)))
(set-interrupt-handler!
(enum interrupt os-signal)
(lambda (type arg enabled-interrupts)
(schedule-event I
(enum event-type interrupt)
(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!
(lambda ()
(let ((enabled-interrupts "JMG: enabled interrupts not yet impl"))
@ -83,11 +107,9 @@
(define interrupt-deliver-lock (make-lock))
(define (call-handlers low-interrupt enabled-interrupts)
(obtain-lock interrupt-deliver-lock)
(for-each (lambda (handler-lock-pair)
((car handler-lock-pair) enabled-interrupts))
(low-interrupt-handler-ref low-interrupt))
(release-lock interrupt-deliver-lock))
(low-interrupt-handler-ref low-interrupt)))
;;; the vm uses the timer for the scheduler