4 -- test blocking & unblocking of async exceptions.
6 -- the first exception "foo" should be caught by the "caught1" handler,
7 -- since async exceptions are blocked outside this handler.
9 -- the second exception "bar" should be caught by the outer "caught2" handler,
10 -- (i.e. this tests that async exceptions are properly unblocked after
14 main_thread <- myThreadId
18 throwTo main_thread (ErrorCall "foo")
19 throwTo main_thread (ErrorCall "bar")
25 sum [1..10000] `seq` -- give 'foo' a chance to be raised
26 (unblock (threadDelay 500000))
27 `Exception.catch` (\e -> putStrLn ("caught1: " ++ show e))
32 (\e -> putStrLn ("caught2: " ++ show e))