From: simonmar Date: Tue, 29 Feb 2000 14:38:19 +0000 (+0000) Subject: [project @ 2000-02-29 14:38:19 by simonmar] X-Git-Tag: Approximately_9120_patches~5080 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=2edb47935ae6e86c1e55efba9f2fa0ddf69dcd6f;p=ghc-hetmet.git [project @ 2000-02-29 14:38:19 by simonmar] Ctrl-C now interrupts the RTS safely. Previously it called shutdownHaskellAndExit() from the signal handler directly, which isn't safe because we may have been interrupted during GC or whatever. Now we set the interrupted flag and wait for the RTS to shut down by itself. --- diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index 2501608..ef5b539 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -1,5 +1,5 @@ /* --------------------------------------------------------------------------- - * $Id: Schedule.c,v 1.46 2000/01/30 10:25:29 simonmar Exp $ + * $Id: Schedule.c,v 1.47 2000/02/29 14:38:19 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -347,7 +347,11 @@ schedule( void ) break; case ThreadKilled: *prev = m->link; - m->stat = Killed; + if (interrupted) { + m->stat = Interrupted; + } else { + m->stat = Killed; + } pthread_cond_broadcast(&m->wakeup); break; default: @@ -369,7 +373,11 @@ schedule( void ) m->stat = Success; return; } else { - m->stat = Killed; + if (interrupted) { + m->stat = Interrupted; + } else { + m->stat = Killed; + } return; } } diff --git a/ghc/rts/Signals.c b/ghc/rts/Signals.c index 36f223b..90b46ba 100644 --- a/ghc/rts/Signals.c +++ b/ghc/rts/Signals.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Signals.c,v 1.13 2000/02/22 12:09:23 simonmar Exp $ + * $Id: Signals.c,v 1.14 2000/02/29 14:38:19 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -263,7 +263,7 @@ shutdown_handler(int sig STG_UNUSED) } else #endif - shutdownHaskellAndExit(EXIT_INTERRUPTED); + interruptStgRts(); } /*