Commit c60b5944 authored by Simon Marlow's avatar Simon Marlow

make this work non-threaded

parent 9edb1875
...@@ -14,9 +14,11 @@ main = do ...@@ -14,9 +14,11 @@ main = do
[s] <- getArgs [s] <- getArgs
let n = read s :: Int let n = read s :: Int
sem <- newQSemN 0 sem <- newQSemN 0
replicateM n (putStr "." >> hFlush stdout >> forkOS (thread sem) >> thread sem) let fork = if rtsSupportsBoundThreads then forkOS else forkIO
replicateM n (putStr "." >> hFlush stdout >> fork (thread sem) >> thread sem)
waitQSemN sem (n*2) waitQSemN sem (n*2)
thread sem = do thread sem = do
var <- newIORef 0 var <- newIORef 0
let f = modifyIORef var (1+) let f = modifyIORef var (1+)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment