summaryrefslogtreecommitdiff
path: root/testsuite/tests/concurrent
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2013-02-20 09:16:52 +0000
committerSimon Marlow <marlowsd@gmail.com>2013-02-20 09:16:52 +0000
commit5e10b984310ca1136be29845695742a64f55cfaa (patch)
treef7786a963840d84580d094f70f5e682e09e46b9b /testsuite/tests/concurrent
parentf65de9e52711bf2399b7614472119efd1b68512a (diff)
downloadhaskell-5e10b984310ca1136be29845695742a64f55cfaa.tar.gz
Revert "Update T3279 to use mask rather than block"
This reverts commit a6d80ce5fb2211af8dafc425705fefb316702802.
Diffstat (limited to 'testsuite/tests/concurrent')
-rw-r--r--testsuite/tests/concurrent/should_run/T3279.hs22
1 files changed, 8 insertions, 14 deletions
diff --git a/testsuite/tests/concurrent/should_run/T3279.hs b/testsuite/tests/concurrent/should_run/T3279.hs
index 46e9b03674..f479704310 100644
--- a/testsuite/tests/concurrent/should_run/T3279.hs
+++ b/testsuite/tests/concurrent/should_run/T3279.hs
@@ -1,30 +1,24 @@
-- test for #3279
-import Data.IORef
import System.IO.Unsafe
import GHC.Conc
import Control.Exception
+f :: Int
+f = (1 +) . unsafePerformIO $ do
+ error "foo" `catch` \(SomeException e) -> do
+ myThreadId >>= flip throwTo e
+ -- point X
+ unblock $ return 1
+
main :: IO ()
main = do
- restoreRef <- newIORef id
-
- let f :: Int
- f = (1 +) . unsafePerformIO $ do
- error "foo" `catch` \(SomeException e) -> do
- myThreadId >>= flip throwTo e
- -- point X
- restore <- readIORef restoreRef
- restore $ return 1
-
evaluate f `catch` \(SomeException e) -> return 0
-- the evaluation of 'x' is now suspended at point X
- tid <- mask $ \restore -> do writeIORef restoreRef restore
- forkIO (evaluate f >> return ())
+ tid <- block $ forkIO (evaluate f >> return ())
killThread tid
-- now execute the 'unblock' above with a pending exception
yield
- writeIORef restoreRef id
-- should print 1 + 1 = 2
print f