[commit: base] master: Remove the reliance on relative accuracy of short delays (#7656) (975ea1a)

Simon Marlow marlowsd at gmail.com
Mon Feb 4 15:47:58 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/975ea1a7bbd1aa129f5c3b0cb4eb0dfb74780a0b

>---------------------------------------------------------------

commit 975ea1a7bbd1aa129f5c3b0cb4eb0dfb74780a0b
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Mon Feb 4 14:38:45 2013 +0000

    Remove the reliance on relative accuracy of short delays (#7656)

>---------------------------------------------------------------

 tests/qsemn001.hs |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/tests/qsemn001.hs b/tests/qsemn001.hs
index 86c0eae..d45c09d 100644
--- a/tests/qsemn001.hs
+++ b/tests/qsemn001.hs
@@ -2,6 +2,7 @@
 import Control.Concurrent
 import Control.Exception
 import Control.Monad
+import Data.List
 
 new = newQSemN
 wait = waitQSemN
@@ -52,33 +53,33 @@ semn2 :: Assertion
 semn2 = do
   c <- newEmptyMVar
   q <- new 0
-  t1 <- forkIO $ do wait q 1; threadDelay 10000;  putMVar c 'a'
+  t1 <- forkIO $ do wait q 1; putMVar c 'a'
   threadDelay 10000
-  t2 <- forkIO $ do wait q 2; threadDelay 20000;  putMVar c 'b'
+  t2 <- forkIO $ do wait q 2; putMVar c 'b'
   threadDelay 10000
-  t3 <- forkIO $ do wait q 3; threadDelay 30000;  putMVar c 'c'
+  t3 <- forkIO $ do wait q 3; putMVar c 'c'
   threadDelay 10000
   signal q 6
   a <-  takeMVar c
   b <-  takeMVar c
   c <-  takeMVar c
-  [a,b,c] @?= "abc"
+  sort [a,b,c] @?= "abc"
 
 semn3 :: Assertion
 semn3 = do
   c <- newEmptyMVar
   q <- new 0
-  t1 <- forkIO $ do wait q 1; threadDelay 10000;  putMVar c 'a'
+  t1 <- forkIO $ do wait q 1; putMVar c 'a'
   threadDelay 10000
-  t2 <- forkIO $ do wait q 2; threadDelay 20000;  putMVar c 'b'
+  t2 <- forkIO $ do wait q 2; putMVar c 'b'
   threadDelay 10000
-  t3 <- forkIO $ do wait q 3; threadDelay 30000;  putMVar c 'c'
+  t3 <- forkIO $ do wait q 3; putMVar c 'c'
   threadDelay 10000
   signal q 3
   a <-  takeMVar c
   b <-  takeMVar c
   threadDelay 10000
-  [a,b] @?= "ab"
+  sort [a,b] @?= "ab"
   d <-  isEmptyMVar c
   d @?= True
   signal q 1





More information about the ghc-commits mailing list