X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=rts%2FRtsStartup.c;h=0ce17fe16f10265fb5f4de7ab89da7cf2122af31;hp=cdb45c60f2ca68c385d0691c8ddfeca9f5e28998;hb=8604da0136707cc14845d14a88c2272fe576b6d0;hpb=8d71be7cbd079f5eab23484a53a43b59dd0399e5 diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index cdb45c6..0ce17fe 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -33,6 +33,7 @@ #include "RtsTypeable.h" #include "Stable.h" #include "Hpc.h" +#include "FileLock.h" #if defined(RTS_GTK_FRONTPANEL) #include "FrontPanel.h" @@ -238,6 +239,11 @@ hs_init(int *argc, char **argv[]) /* initialise the shared Typeable store */ initTypeableStore(); + /* initialise file locking, if necessary */ +#if !defined(mingw32_HOST_OS) + initFileLocking(); +#endif + #if defined(DEBUG) /* initialise thread label table (tso->char*) */ initThreadLabelTable(); @@ -275,10 +281,6 @@ hs_init(int *argc, char **argv[]) x86_init_fpu(); #endif -#if defined(THREADED_RTS) - ioManagerStart(); -#endif - /* Record initialization times */ stat_endInit(); } @@ -354,6 +356,11 @@ hs_add_root(void (*init_root)(void)) // This must be done after module initialisation. // ToDo: make this work in the presence of multiple hs_add_root()s. initProfiling2(); + + // ditto. +#if defined(THREADED_RTS) + ioManagerStart(); +#endif } /* ---------------------------------------------------------------------------- @@ -462,6 +469,11 @@ hs_exit_(rtsBool wait_foreign) /* free shared Typeable store */ exitTypeableStore(); + /* free file locking tables, if necessary */ +#if !defined(mingw32_HOST_OS) + freeFileLocking(); +#endif + /* free the stable pointer table */ exitStablePtrTable(); @@ -487,7 +499,7 @@ hs_exit_(rtsBool wait_foreign) // Originally, this was in report_ccs_profiling(). Now, retainer // profiling might tack some extra stuff on to the end of this file // during endProfiling(). - fclose(prof_file); + if (prof_file != NULL) fclose(prof_file); #endif #if defined(TICKY_TICKY)