函数mask_被异步异常中断

hig*_*y22 0 haskell asynchronous exception

import Control.Exception
import System.Timeout
import Control.Concurrent

maskWorker :: IO ()
maskWorker = mask_ $ do 
      threadDelay 10000
      putStrLn $ "Return"

uninterruptWorker :: IO ()
uninterruptWorker = uninterruptibleMask_ $ do
      threadDelay 10000
      putStrLn $ "Return"

test :: IO () -> IO ()
test worker = do
             pid <- forkIO worker
             threadDelay 5000
             throwTo pid UserInterrupt
             threadDelay 15000
             putStrLn "The end"
Run Code Online (Sandbox Code Playgroud)

函数mask_应该忽略异步异常,直到它返回.但"test maskWorker"不会打印"返回".为什么?

Yur*_*ras 5

mask不阻止所有异步异常,只是将它们推迟到下一个可中断的动作.使用uniterruptibleMask阻止所有异步异常.