[project @ 1999-07-06 15:33:23 by simonmar]
[ghc-hetmet.git] / ghc / rts / RtsStartup.c
index aa84c0b..d87f188 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsStartup.c,v 1.15 1999/07/02 09:31:54 simonmar Exp $
+ * $Id: RtsStartup.c,v 1.17 1999/07/06 15:33:23 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -139,6 +139,20 @@ startupHaskell(int argc, char *argv[])
     end_init();
 }
 
+/*
+ * Shutting down the RTS - two ways of doing this, one which
+ * calls exit(), one that doesn't.
+ *
+ * (shutdownHaskellAndExit() is called by System.exitWith).
+ */
+void
+shutdownHaskellAndExit(int n)
+{
+  OnExitHook();
+  shutdownHaskell();
+  stg_exit(n);
+}
+
 void
 shutdownHaskell(void)
 {
@@ -174,7 +188,7 @@ shutdownHaskell(void)
 
 
 /* 
- * called from STG-land to exit the program cleanly 
+ * called from STG-land to exit the program
  */
 
 void  
@@ -183,7 +197,7 @@ stg_exit(I_ n)
 #ifdef PAR
   par_exit(n);
 #else
-  OnExitHook();
   exit(n);
 #endif
 }
+