summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-02-26 21:25:23 -0500
committerBen Gamari <ben@well-typed.com>2020-12-01 12:48:54 -0500
commitc93f11feeb918c3c62c0af1f7e757943d52f7f8e (patch)
tree05c902a9c185484cf8346219df7f383be2bd7816
parent2161aed846f50088b226b03f61eb6d223306bcc9 (diff)
downloadhaskell-c93f11feeb918c3c62c0af1f7e757943d52f7f8e.tar.gz
rts: Fix timer initialization
Previously `initScheduler` would attempt to pause the ticker and in so doing acquire the ticker mutex. However, initTicker, which is responsible for initializing said mutex, hadn't been called yet.
-rw-r--r--rts/RtsStartup.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 49cf0d10f4..aee50cf470 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)