diff options
author | Nicolas Frisby <nicolas.frisby@gmail.com> | 2013-08-22 15:00:41 -0500 |
---|---|---|
committer | Nicolas Frisby <nicolas.frisby@gmail.com> | 2013-08-22 15:00:54 -0500 |
commit | 84f9927c1a04b8e35b97101771d8f6d625643d9b (patch) | |
tree | 050d7265a24fa1ff9aecc4081bb01bc444520587 /rts/RtsStartup.c | |
parent | 2eaf46fb1bb8c661c03f3e5e80622207ef2509d9 (diff) | |
parent | c24be4b761df558d9edc9c0b1554bb558c261b14 (diff) | |
download | haskell-late-dmd.tar.gz |
merged master into late-dmdlate-dmd
Diffstat (limited to 'rts/RtsStartup.c')
-rw-r--r-- | rts/RtsStartup.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index 7b7d488e2b..39c5ef1f94 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -38,10 +38,6 @@ #include "FileLock.h" void exitLinker( void ); // there is no Linker.h file to include -#if defined(RTS_GTK_FRONTPANEL) -#include "FrontPanel.h" -#endif - #if defined(PROFILING) # include "ProfHeap.h" # include "RetainerProfile.h" @@ -237,17 +233,11 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config) initDefaultHandlers(); } #endif - + #if defined(mingw32_HOST_OS) && !defined(THREADED_RTS) startupAsyncIO(); #endif -#ifdef RTS_GTK_FRONTPANEL - if (RtsFlags.GcFlags.frontpanel) { - initFrontPanel(); - } -#endif - #if X86_INIT_FPU x86_init_fpu(); #endif @@ -293,7 +283,7 @@ hs_add_root(void (*init_root)(void) STG_UNUSED) * False ==> threads doing foreign calls may return in the * future, but will immediately block on a mutex. * (capability->lock). - * + * * If this RTS is a DLL that we're about to unload, then you want * safe=True, otherwise the thread might return to code that has been * unloaded. If this is a standalone program that is about to exit, @@ -305,6 +295,8 @@ hs_add_root(void (*init_root)(void) STG_UNUSED) static void hs_exit_(rtsBool wait_foreign) { + nat g; + if (hs_init_count <= 0) { errorBelch("warning: too many hs_exit()s"); return; @@ -317,7 +309,7 @@ hs_exit_(rtsBool wait_foreign) /* start timing the shutdown */ stat_startExit(); - + OnExitHook(); flushStdHandles(); @@ -335,8 +327,10 @@ hs_exit_(rtsBool wait_foreign) exitScheduler(wait_foreign); /* run C finalizers for all active weak pointers */ - runAllCFinalizers(weak_ptr_list); - + for (g = 0; g < RtsFlags.GcFlags.generations; g++) { + runAllCFinalizers(generations[g].weak_ptr_list); + } + #if defined(RTS_USER_SIGNALS) if (RtsFlags.MiscFlags.install_signal_handlers) { freeSignalHandlers(); @@ -348,7 +342,7 @@ hs_exit_(rtsBool wait_foreign) exitTimer(wait_foreign); // set the terminal settings back to what they were -#if !defined(mingw32_HOST_OS) +#if !defined(mingw32_HOST_OS) resetTerminalSettings(); #endif @@ -357,14 +351,14 @@ hs_exit_(rtsBool wait_foreign) /* stop timing the shutdown, we're about to print stats */ stat_endExit(); - + /* shutdown the hpc support (if needed) */ exitHpc(); // clean up things from the storage manager's point of view. // also outputs the stats (+RTS -s) info. exitStorage(); - + /* free the tasks */ freeScheduler(); @@ -385,13 +379,7 @@ hs_exit_(rtsBool wait_foreign) freeThreadLabelTable(); #endif -#ifdef RTS_GTK_FRONTPANEL - if (RtsFlags.GcFlags.frontpanel) { - stopFrontPanel(); - } -#endif - -#if defined(PROFILING) +#if defined(PROFILING) reportCCSProfiling(); #endif @@ -479,15 +467,15 @@ shutdownHaskellAndSignal(int sig) } #endif -/* +/* * called from STG-land to exit the program */ void (*exitFn)(int) = 0; -void +void stg_exit(int n) -{ +{ if (exitFn) (*exitFn)(n); exit(n); |