From e729ddd2ba4218f8090de050343dc6b7bd203339 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Fri, 24 Jan 2025 09:59:28 +0100 Subject: [PATCH] Label the internal thread spawned in linkOnly --- Control/Concurrent/Async/Internal.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Control/Concurrent/Async/Internal.hs b/Control/Concurrent/Async/Internal.hs index e099fd9..1603f5d 100644 --- a/Control/Concurrent/Async/Internal.hs +++ b/Control/Concurrent/Async/Internal.hs @@ -55,7 +55,7 @@ import Data.IORef import GHC.Exts import GHC.IO hiding (finally, onException) -import GHC.Conc (ThreadId(..)) +import GHC.Conc (ThreadId(..), labelThread) -- ----------------------------------------------------------------------------- -- STM Async API @@ -504,6 +504,7 @@ linkOnly linkOnly shouldThrow a = do me <- myThreadId void $ forkRepeat $ do + myThreadId >>= flip labelThread ("linkOnly " ++ show (asyncThreadId a) ++ " -> " ++ show me) r <- waitCatch a case r of Left e | shouldThrow e -> throwTo me (ExceptionInLinkedThread a e) @@ -684,6 +685,7 @@ concurrently' left right collect = do -- putMVar. when (count' > 0) $ void $ forkIO $ do + myThreadId >>= flip labelThread "concurrent stop" throwTo rid AsyncCancelled throwTo lid AsyncCancelled -- ensure the children are really dead