On Sat, Oct 29, 2011 at 12:18 PM, Brian Johnson <brianjohnsonhaskellcafe@gmail.com> wrote:


"When the interrupt signal is received, the default behaviour of the runtime is to attempt to shut down the Haskell program gracefully. It does this by calling interruptStgRts() in rts/Schedule.c (see Commentary/Rts/Scheduler#ShuttingDown). If a second interrupt signal is received, then we terminate the process immediately; this is just in case the normal shutdown procedure failed or hung for some reason, the user is always able to stop the process with two control-C keystrokes"

On further thought, there is something sensible here: the RTS might crash while trying to exit.  I propose, for POSIX environments, the following change to SIGINT handling:

* SIGINT is transformed into UserInterrupt during normal program execution
* Once the RTS is committed to exiting, it resets the signal handler for SIGINT so that any additional control-c causes an immediate exit

Makes sense?

Brian