Skip to content
Snippets Groups Projects
Unverified Commit 2eb25dbb authored by Zubin's avatar Zubin
Browse files

Explain uninterruptibleMask

parent 3d3058f0
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment