Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/a31947e182854075fe0184809436ab510f388803

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

commit a31947e182854075fe0184809436ab510f388803
Author: Simon Marlow <[email protected]>
Date:   Thu Aug 23 09:36:51 2012 +0100

    fix this test not to use QSemN (which has gone)

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

 tests/concurrent/should_run/conc023.hs |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/tests/concurrent/should_run/conc023.hs 
b/tests/concurrent/should_run/conc023.hs
index b128c22..3c433b6 100644
--- a/tests/concurrent/should_run/conc023.hs
+++ b/tests/concurrent/should_run/conc023.hs
@@ -8,16 +8,15 @@
 import System.Random
 import Control.Concurrent
 import Control.Exception
+import Control.Monad
 
 n = 5000  -- no. of threads
 m = 3000  -- maximum delay
 
 main = do
-   s <- newQSemN n
-   (is :: [Int]) <- sequence (take n (repeat (getStdRandom (randomR (1,m)))))
-   mapM (fork_sleep s) is
-   waitQSemN s n
+   v <- newEmptyMVar
+   is <- replicateM n $ getStdRandom (randomR (1,m))
+   mapM_ (fork_sleep v) is
+   replicateM_ n (takeMVar v)
    where
-       fork_sleep s i = forkIO (do waitQSemN s 1
-                                   threadDelay (i*1000)
-                                   signalQSemN s 1)
+     fork_sleep v i = forkIO $ do threadDelay (i*1000); putMVar v ()



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to