Skip to content

Commit

Permalink
Label the internal thread spawned in linkOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Jan 24, 2025
1 parent 7ac0e51 commit e729ddd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Control/Concurrent/Async/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e729ddd

Please sign in to comment.