summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZubin Duggal <zubin@cmi.ac.in>2021-02-26 01:56:33 +0530
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-27 08:00:46 -0500
commit629dd56deedcd1162ef5417a9e446f6f1c2b667a (patch)
tree8c07830b403a5b11ff065c1dd71cbe9284a79cd2
parent902ece87ffac545451c2a66d145e6c8653e12092 (diff)
downloadhaskell-629dd56deedcd1162ef5417a9e446f6f1c2b667a.tar.gz
Remove unnecessary killThread
-rw-r--r--compiler/GHC/Data/IOEnv.hs15
1 files changed, 6 insertions, 9 deletions
diff --git a/compiler/GHC/Data/IOEnv.hs b/compiler/GHC/Data/IOEnv.hs
index e438cfaf0d..c6077d6a94 100644
--- a/compiler/GHC/Data/IOEnv.hs
+++ b/compiler/GHC/Data/IOEnv.hs
@@ -176,15 +176,12 @@ safeTry act = do
uninterruptibleMask $ \restore -> do
-- Fork, so that 'act' is safe from all asynchronous exceptions other than the ones we send it
t <- forkIO $ try (restore act) >>= putMVar var
- r <- (restore $ readMVar var)
- `catch` \(e :: SomeException) -> do
- -- Control reaches this point only if the parent thread was sent an async exception
- -- In that case, kill the 'act' thread and re-raise the exception
- killThread t
- throwIO e
- -- cleanup and return
- killThread t
- pure r
+ restore (readMVar var)
+ `catch` \(e :: SomeException) -> do
+ -- Control reaches this point only if the parent thread was sent an async exception
+ -- In that case, kill the 'act' thread and re-raise the exception
+ killThread t
+ throwIO e
tryMostM :: IOEnv env r -> IOEnv env (Either SomeException r)
tryMostM (IOEnv thing) = IOEnv (\ env -> tryMost (thing env))