From b0ad86fb84fbd2ac78208e6545c48c7a09e7f4aa Mon Sep 17 00:00:00 2001
From: GHC GitLab CI <ghc-ci@gitlab-haskell.org>
Date: Thu, 10 Dec 2020 03:55:51 +0000
Subject: [PATCH] nonmoving: Add comments to nonmovingResurrectThreads

---
 rts/sm/NonMovingMark.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/rts/sm/NonMovingMark.c b/rts/sm/NonMovingMark.c
index 183c366a5626..16085cb27a03 100644
--- a/rts/sm/NonMovingMark.c
+++ b/rts/sm/NonMovingMark.c
@@ -1929,6 +1929,8 @@ void nonmovingTidyThreads ()
     }
 }
 
+// Mark threads which appear to be dead but still need to be properly torn down
+// by resurrectThreads.
 void nonmovingResurrectThreads (struct MarkQueue_ *queue, StgTSO **resurrected_threads)
 {
     StgTSO *next;
@@ -1940,6 +1942,9 @@ void nonmovingResurrectThreads (struct MarkQueue_ *queue, StgTSO **resurrected_t
         case ThreadComplete:
             continue;
         default:
+            // The thread may be, e.g., deadlocked in which case we must ensure
+            // it isn't swept since resurrectThreads will need to throw it an
+            // exception.
             markQueuePushClosure_(queue, (StgClosure*)t);
             t->global_link = *resurrected_threads;
             *resurrected_threads = t;
-- 
GitLab