diff options
author | Simon Marlow <marlowsd@gmail.com> | 2013-02-20 09:26:27 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2013-02-20 09:26:27 +0000 |
commit | d1d45e89cfa8df13caa045e153cdf733e217884c (patch) | |
tree | 0e86802b8a0e7881c22aa36b1964cf162363a63f | |
parent | f2a8479da2c984a6d2aa44a02c1817e064d3e7e1 (diff) | |
download | haskell-d1d45e89cfa8df13caa045e153cdf733e217884c.tar.gz |
The "unblock" was important here
Because catch implicitly masks the exception handler.
-rw-r--r-- | testsuite/tests/concurrent/should_run/throwto003.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/testsuite/tests/concurrent/should_run/throwto003.hs b/testsuite/tests/concurrent/should_run/throwto003.hs index 8f62fb30da..37540cc68a 100644 --- a/testsuite/tests/concurrent/should_run/throwto003.hs +++ b/testsuite/tests/concurrent/should_run/throwto003.hs @@ -5,12 +5,12 @@ import Control.Monad main = do m <- newMVar 1 - t1 <- forkIO $ thread m + t1 <- mask $ \restore -> forkIO $ thread restore m t2 <- forkIO $ forever $ killThread t1 threadDelay 1000000 takeMVar m -thread m = run +thread restore m = run where - run = (forever $ modifyMVar_ m $ \v -> if v `mod` 2 == 1 then return (v*2) else return (v-1)) + run = (restore $ forever $ modifyMVar_ m $ \v -> if v `mod` 2 == 1 then return (v*2) else return (v-1)) `catch` \(e::SomeException) -> run |