diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index 49cf0d10f42df19e633f6816a5c35bf7f3943064..aee50cf47078e0a099c02a63c0d37441ea27c954 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -232,6 +232,13 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config) /* Initialise libdw session pool */ libdwPoolInit(); + /* Start the "ticker" and profiling timer but don't start until the + * scheduler is up. However, the ticker itself needs to be initialized + * before the scheduler to ensure that the ticker mutex is initialized as + * moreCapabilities will attempt to acquire it. + */ + initTimer(); + /* initialise scheduler data structures (needs to be done before * initStorage()). */ @@ -314,7 +321,6 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config) initHeapProfiling(); /* start the virtual timer 'subsystem'. */ - initTimer(); startTimer(); #if defined(RTS_USER_SIGNALS)