blob: c1410828facbe8d17939951c684b5a01816f7f44 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
{-# LANGUAGE CPP #-}
module Main where
import Control.Exception
import Control.Concurrent
#if __GLASGOW_HASKELL__ < 705
import Prelude hiding (catch)
#endif
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))
|