summaryrefslogtreecommitdiff
path: root/testsuite/tests/concurrent/should_run/conc073.hs
blob: 64d9d998a60c0748e7cbcb498b4428ce6da3b5e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import Control.Exception
import Control.Concurrent

main = do
  m1 <- newEmptyMVar
  m2 <- newEmptyMVar
  t <- forkIO $ do
    mask_ $ return ()
    throwIO (ErrorCall "test") `catch`
       \e -> do
         let _ = e::SomeException
         print =<< getMaskingState
         putMVar m1 ()
         takeMVar m2
  takeMVar m1
  killThread t
   -- in GHC 7.2 and earlier this call will deadlock due to bug #4988.
   -- However, the RTS will resurrect the child thread, and in doing
   -- so will unblock the main thread, so the main thread doesn't get
   -- a BlockedIndefinitely exception.