An interrupt handler written in Chicken Scheme probably can't do a lot
without knocking over a heap of dominoes.

Nevertheless, would a simple lambda that only changes a top level flag
variable be stable enough to be useful?  This is often all that posix
interrupt handlers written in C do anyway.

This is the sort of thing I'm thinking of.  When the interrupt is
fired, procedure sigX is executed irrespective of the current state of
Chicken.  The following should be read as pseudocode rather than a
skeleton for actual implementation.

(define (sigX-flag #f)

(procedure (sigX-handler)
 (set! sigX-flag #t))

(procedure (handle-sigX)
 (with-interrupts-disabled
   (lambda ()
     (do-some-stuff)
     (set! sigX-flag #f))))

(set-sigX-handler-to-handle-sigX)
(let loop ((...))
 (if sigX-flag
   (handle-sigX)
   (begin
     (do-something-else)
     (loop ...)))


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to