FIX part of #2301
Control-C now causes the new exception (AsyncException UserInterrupt)
to be raised in the main thread. The signal handler is set up by
GHC.TopHandler.runMainIO, and can be overriden in the usual way by
installing a new signal handler. The advantage is that now all
programs will get a chance to clean up on ^C.
When UserInterrupt is caught by the topmost handler, we now exit the
program via kill(getpid(),SIGINT), which tells the parent process that
we exited as a result of ^C, so the parent can take appropriate action
(it might want to exit too, for example).
One subtlety is that we have to use a weak reference to the ThreadId
for the main thread, so that the signal handler doesn't prevent the
main thread from being subject to deadlock detection.