[project @ 2000-02-29 14:38:19 by simonmar]
authorsimonmar <unknown>
Tue, 29 Feb 2000 14:38:19 +0000 (14:38 +0000)
committersimonmar <unknown>
Tue, 29 Feb 2000 14:38:19 +0000 (14:38 +0000)
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.

ghc/rts/Schedule.c
ghc/rts/Signals.c

index 2501608..ef5b539 100644 (file)
@@ -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;
        }
       }
index 36f223b..90b46ba 100644 (file)
@@ -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();
 }
 
 /*