diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-10-24 19:51:15 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-11-24 12:03:06 -0500 |
commit | 543ad4f3f8320c17be0029078a1cbe832f5b6f56 (patch) | |
tree | 7c85a738bec271905240fab35ec176546cd0a2b0 | |
parent | f65a5c9ea49c8a44df24b442b8879dccb094e503 (diff) | |
download | haskell-wip/tsan-ghc-9.0.tar.gz |
rts: Tear down stats_mutex after exitHeapProfilingwip/tsan-ghc-9.0
Since the latter wants to call getRTSStats.
-rw-r--r-- | rts/RtsStartup.c | 4 | ||||
-rw-r--r-- | rts/Stats.c | 12 | ||||
-rw-r--r-- | rts/Stats.h | 1 | ||||
-rw-r--r-- | rts/sm/Storage.c | 2 |
4 files changed, 14 insertions, 5 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index c08c93162f..5f771911af 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -574,6 +574,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 251353de6d..98aefa9a4b 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -302,7 +302,7 @@ exitStorage (void) { nonmovingExit(); updateNurseriesStats(); - stat_exit(); + stat_exitReport(); } void |