diff --git a/compiler/GHC/Data/IOEnv.hs b/compiler/GHC/Data/IOEnv.hs index c6077d6a945c71e4882cc9886d3af92f918427fa..7035b82b817965fac475eb14c28be97c5b57531e 100644 --- a/compiler/GHC/Data/IOEnv.hs +++ b/compiler/GHC/Data/IOEnv.hs @@ -173,6 +173,7 @@ tryAllM (IOEnv thing) = IOEnv (\ env -> safeTry (thing env)) safeTry :: IO a -> IO (Either SomeException a) safeTry act = do var <- newEmptyMVar + -- uninterruptible because we want to mask around 'killThread', which is interruptible. 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