Repository : ssh://darcs.haskell.org//srv/darcs/nofib On branch : master
http://hackage.haskell.org/trac/ghc/changeset/c19f3a54cf37d8af27c0abae6b01c452a38a3534 >--------------------------------------------------------------- commit c19f3a54cf37d8af27c0abae6b01c452a38a3534 Author: David Terei <[email protected]> Date: Thu Mar 29 16:15:51 2012 -0700 Fix callback001 >--------------------------------------------------------------- smp/callback001/Main.hs | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/smp/callback001/Main.hs b/smp/callback001/Main.hs index 493fd0f..31f4cdd 100644 --- a/smp/callback001/Main.hs +++ b/smp/callback001/Main.hs @@ -13,27 +13,27 @@ module Main where import Control.Concurrent import Control.Monad -import Foreign.Ptr import Data.IORef +import Foreign.Ptr import System.Environment import System.IO main = do [s] <- getArgs - let n = read s :: Int + let n = read s :: Int + fork = if rtsSupportsBoundThreads then forkOS else forkIO sem <- newQSemN 0 - let fork = if rtsSupportsBoundThreads then forkOS else forkIO - replicateM n (putStr "." >> hFlush stdout >> fork (thread sem) >> thread sem) + replicateM n $ putStr "." >> hFlush stdout >> fork (thread sem) >> thread sem + putChar '\n' waitQSemN sem (n*2) - thread sem = do var <- newIORef 0 let f = modifyIORef var (1+) callC =<< mkFunc f signalQSemN sem 1 -type FUNC = IO () +type FUNC = IO () foreign import ccall unsafe "wrapper" mkFunc :: FUNC -> IO (FunPtr FUNC) _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
