[gambit-list] Interrupted in wait-for-io

Christian christian at pflanze.mine.nu
Tue Jan 3 09:15:00 EST 2006


Why aren't interrupts (ctl-c in particular) running the current
exception handler, but instead enter the debugger unconditionally?

$ cat testinterrupt.scm
 (lambda (e)
   (display "Catched an exception: ")
   (write e)
 (lambda ()

$ gsi
> (load "testinterrupt.scm")
*** INTERRUPTED IN ##wait-for-io!
1> fooo
Catched an exception: #<unbound-global-exception #2>
1> foo
*** ERROR IN (console)@3.1 -- Unbound variable: foo

Note that inside the debugger, my exception handler is still active,
as shown after entering |fooo|. So it's not that ##wait-for-io or some
other function would install another handler, but that the
current-exception-handler is simply ignored.

Same thing in compiled code, except that there's no handler catching
exceptions when inside mine:

$ gsc -warnings testinterrupt
$ gcc -O3 -fomit-frame-pointer -mpreferred-stack-boundary=2 -Wdisabled-optimization testinterrupt.c testinterrupt_.c -I/usr/local/Gambit-C/include -L/usr/local/Gambit-C/lib -lgambc -lm -lutil -ldl -o testinterrupt

$ ./testinterrupt 
*** INTERRUPTED IN ##wait-for-io!
> foo
Catched an exception: #<unbound-global-exception #2>
> foo
*** ERROR IN (console)@2.1 -- Unbound variable: foo

The real problem with this is: how can I create a standalone Gambit
program that exits when it gets SIGINT ?


More information about the Gambit-list mailing list