From 9ca56dd3f3ede423766c9db2546e15abd4ab0ddc Mon Sep 17 00:00:00 2001
From: Ian-Woo Kim <ianwookim@gmail.com>
Date: Sat, 10 Feb 2024 08:54:11 -0800
Subject: [PATCH] mutex wrap in refreshProfilingCCSs

---
 rts/Profiling.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/rts/Profiling.c b/rts/Profiling.c
index 2cf4a97ea6a5..b039facfbf60 100644
--- a/rts/Profiling.c
+++ b/rts/Profiling.c
@@ -204,6 +204,7 @@ void initProfiling (void)
 //
 void refreshProfilingCCSs (void)
 {
+    ACQUIRE_LOCK(&ccs_mutex);
     // make CCS_MAIN the parent of all the pre-defined CCSs.
     CostCentreStack *next;
     for (CostCentreStack *ccs = CCS_LIST; ccs != NULL; ) {
@@ -214,6 +215,7 @@ void refreshProfilingCCSs (void)
         ccs = next;
     }
     CCS_LIST = NULL;
+    RELEASE_LOCK(&ccs_mutex);
 }
 
 void
-- 
GitLab