[project @ 2000-04-04 10:04:47 by simonmar]
authorsimonmar <unknown>
Tue, 4 Apr 2000 10:04:47 +0000 (10:04 +0000)
committersimonmar <unknown>
Tue, 4 Apr 2000 10:04:47 +0000 (10:04 +0000)
- make the second ^C kill the program immediately (the first one tries
  to interrupt it safely by killing all the threads, running
  finalizers etc.).

- don't ignore SIGPIPE by default, the program can do this itself.

ghc/rts/Signals.c

index 0b9f3a9..d5f0c75 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Signals.c,v 1.15 2000/03/15 15:31:36 simonmar Exp $
+ * $Id: Signals.c,v 1.16 2000/04/04 10:04:47 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -264,7 +264,15 @@ shutdown_handler(int sig STG_UNUSED)
   } else
 #endif
 
-    interruptStgRts();
+  /* If we're already trying to interrupt the RTS, terminate with
+   * extreme prejudice.  So the first ^C tries to exit the program
+   * cleanly, and the second one just kills it.
+   */
+  if (interrupted) {
+      exit(EXIT_INTERRUPTED);
+  } else {
+      interruptStgRts();
+  }
 }
 
 /*
@@ -274,10 +282,6 @@ shutdown_handler(int sig STG_UNUSED)
  * Haskell code may install their own SIGINT handler, which is
  * fine, provided they're so kind as to put back the old one
  * when they de-install.
- *
- * We ignore SIGPIPE, because our I/O library handles EPIPE properly,
- * and a SIGPIPE tends to cause the program to exit silently and
- * mysteriously.
  */
 void
 init_default_handlers()
@@ -294,11 +298,6 @@ init_default_handlers()
       /* Oh well, at least we tried. */
       prog_belch("failed to install SIGINT handler");
     }
-
-    action.sa_handler = SIG_IGN;
-    if (sigaction(SIGPIPE, &action, &oact) != 0) {
-      prog_belch("failed to install SIGINT handler");
-    }
 }
 
 #endif /*! mingw32_TARGET_OS */