(not) catching ^C in ghc-built application
Hal Daume III
hdaume@ISI.EDU
Mon, 12 Aug 2002 09:51:49 -0700 (PDT)
> So, what should I use instead?
This is just a guess until someone who actually knows what they're talking
about answers, but...
In /ghc/rts/Schedule.c, there's a function:
void
interruptStgRts(void)
{
interrupted = 1;
context_switch = 1;
}
which basically tells the rts to emit an interrupted message here:
/* If we're interrupted (the user pressed ^C, or some other
* termination condition occurred), kill all the currently running
* threads.
*/
if (interrupted) {
IF_DEBUG(scheduler, sched_belch("interrupted"));
deleteAllThreads();
interrupted = rtsFalse;
was_interrupted = rtsTrue;
}
My guess is that if you override the interruptStgRts function as per
section 4.16.4 in the ghc users guide, you should be able to fix this
problem. Simply overriding it with a function that *doesn't* set
interrupted to 1 should be fine (you shouldn't need to set context_switch
to 1 either).
Don't kill me if this doesn't work though :)
- Hal