diff options
author | Simon Marlow <marlowsd@gmail.com> | 2008-11-14 11:38:59 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2008-11-14 11:38:59 +0000 |
commit | 0af014df03c46da3b392a303ded2ae555cd40f67 (patch) | |
tree | 6f2f622f9d764cfad77e7f2c84eb8369b2d221c0 /testsuite/tests/ghc-regress/concurrent | |
parent | 3fff1f0f9914e9e83a80e5b9581157b2d4b13d45 (diff) | |
download | haskell-0af014df03c46da3b392a303ded2ae555cd40f67.tar.gz |
make this test a bit more robust
Diffstat (limited to 'testsuite/tests/ghc-regress/concurrent')
-rw-r--r-- | testsuite/tests/ghc-regress/concurrent/should_run/conc064.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/testsuite/tests/ghc-regress/concurrent/should_run/conc064.hs b/testsuite/tests/ghc-regress/concurrent/should_run/conc064.hs index 08c474ce72..d37387c601 100644 --- a/testsuite/tests/ghc-regress/concurrent/should_run/conc064.hs +++ b/testsuite/tests/ghc-regress/concurrent/should_run/conc064.hs @@ -6,10 +6,18 @@ import Control.Exception main = do master <- myThreadId test master 10 + -- make sure we catch a final NonTermination exception to get + -- a consistent result. + threadDelay (10 * one_second) test tid 0 = return () -test tid n = handle (\(e::NonTermination) -> test tid (n-1)) $ do - sequence $ replicate 3 $ +test tid n = do + e <- try threads + case e of + Left NonTermination -> test tid (n-1) + Right _ -> return () + where + threads = do sequence $ replicate 3 $ forkIO $ do t <- myThreadId --putStrLn ("Start " ++ show t) threadDelay one_second |