From c703cb398f980a1a799a5a7dbee763db12cc5f7f Mon Sep 17 00:00:00 2001 From: Zubin Duggal Date: Fri, 26 Feb 2021 02:26:32 +0530 Subject: Explain uninterruptibleMask --- compiler/GHC/Data/IOEnv.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/GHC/Data/IOEnv.hs b/compiler/GHC/Data/IOEnv.hs index c6077d6a94..7035b82b81 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 -- cgit v1.2.1