summaryrefslogtreecommitdiff
path: root/testsuite/tests/concurrent/should_run/conc024.hs
blob: 7d8662ae0892eb858980c2ae04e17c3993d445b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# LANGUAGE CPP #-}
module Main where

import Control.Exception
import Control.Concurrent
import System.Mem

-- illustrates the BlockOnDeadMVar exception

main = do
  id <- myThreadId
  forkIO (catch (do m <- newEmptyMVar; takeMVar m)
                (\e -> throwTo id (e::SomeException)))
  catch (do yield; performGC; threadDelay 1000000)
        (\e -> print (e::SomeException))