summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-10-24 19:51:15 -0400
committerBen Gamari <ben@smart-cactus.org>2020-11-01 12:58:36 -0500
commit5c2e6bced838b7d7617af2bfb272889a9af16a76 (patch)
tree919af25048be5c7c42a31bb33d0a932db52036e3
parentb1dda15324bf08dcd6265e066577c18d4f3f061d (diff)
downloadhaskell-5c2e6bced838b7d7617af2bfb272889a9af16a76.tar.gz
rts: Tear down stats_mutex after exitHeapProfilingwip/tsan/stats
Since the latter wants to call getRTSStats.
-rw-r--r--rts/RtsStartup.c4
-rw-r--r--rts/Stats.c12
-rw-r--r--rts/Stats.h1
-rw-r--r--rts/sm/Storage.c2
4 files changed, 14 insertions, 5 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index a3dddb03f5..a20dc3d04a 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -575,6 +575,10 @@ hs_exit_(bool wait_foreign)
if (is_io_mng_native_p())
hs_restoreConsoleCP();
#endif
+
+ /* tear down statistics subsystem */
+ stat_exit();
+
/* free hash table storage */
exitHashTable();
diff --git a/rts/Stats.c b/rts/Stats.c
index 44cf83e901..71dcf8a9d0 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -1245,7 +1245,7 @@ static void report_one_line(const RTSSummaryStats * sum)
}
void
-stat_exit (void)
+stat_exitReport (void)
{
RTSSummaryStats sum;
init_RTSSummaryStats(&sum);
@@ -1450,9 +1450,6 @@ stat_exit (void)
}
}
RELEASE_LOCK(&stats_mutex);
-#if defined(THREADED_RTS)
- closeMutex(&stats_mutex);
-#endif
statsFlush();
statsClose();
@@ -1476,6 +1473,13 @@ stat_exit (void)
RELEASE_LOCK(&all_tasks_mutex);
}
+void stat_exit()
+{
+#if defined(THREADED_RTS)
+ closeMutex(&stats_mutex);
+#endif
+}
+
/* Note [Work Balance]
----------------------
Work balance is a measure of how evenly the work done during parallel garbage
diff --git a/rts/Stats.h b/rts/Stats.h
index 103564a82a..9d62acef37 100644
--- a/rts/Stats.h
+++ b/rts/Stats.h
@@ -58,6 +58,7 @@ void stat_endHeapCensus(void);
void stat_startExit(void);
void stat_endExit(void);
+void stat_exitReport(void);
void stat_exit(void);
void stat_workerStop(void);
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index 96bc133d02..c8c07db737 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -302,7 +302,7 @@ exitStorage (void)
{
nonmovingExit();
updateNurseriesStats();
- stat_exit();
+ stat_exitReport();
}
void