[project @ 1999-09-13 11:02:08 by sof]
[ghc-hetmet.git] / ghc / rts / RtsStartup.c
index 1c50c08..19e1b3e 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsStartup.c,v 1.16 1999/07/03 18:39:40 sof Exp $
+ * $Id: RtsStartup.c,v 1.19 1999/09/13 11:02:08 sof Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -15,6 +15,8 @@
 #include "StablePriv.h" /* initStablePtrTable */
 #include "Schedule.h"   /* initScheduler */
 #include "Stats.h"      /* initStats */
+#include "Signals.h"
+#include "Itimer.h"
 #include "Weak.h"
 #include "Ticky.h"
 
@@ -110,13 +112,18 @@ startupHaskell(int argc, char *argv[])
     initProfiling();
 #endif
 
+    /* start the ticker */
+    install_vtalrm_handler();
+    initialize_virtual_timer(TICK_MILLISECS);
+
     /* Initialise the scheduler */
     initScheduler();
 
     /* Initialise the stats department */
     initStats();
 
-#if 0
+    /* Initialise the user signal handler set */
+#if !defined(mingw32_TARGET_OS) && !defined(PAR)
     initUserSignals();
 #endif
  
@@ -148,6 +155,7 @@ startupHaskell(int argc, char *argv[])
 void
 shutdownHaskellAndExit(int n)
 {
+  OnExitHook();
   shutdownHaskell();
   stg_exit(n);
 }
@@ -170,6 +178,9 @@ shutdownHaskell(void)
   /* clean up things from the storage manager's point of view */
   exitStorage();
 
+  /* stop the ticker */
+  initialize_virtual_timer(0);
+
 #if defined(PROFILING) || defined(DEBUG)
   endProfiling();
 #endif
@@ -187,7 +198,7 @@ shutdownHaskell(void)
 
 
 /* 
- * called from STG-land to exit the program cleanly 
+ * called from STG-land to exit the program
  */
 
 void  
@@ -196,7 +207,7 @@ stg_exit(I_ n)
 #ifdef PAR
   par_exit(n);
 #else
-  OnExitHook();
   exit(n);
 #endif
 }
+