Created
August 30, 2010 21:12
-
-
Save bos/558062 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Concurrent | |
import Control.Monad | |
import qualified Data.ByteString as B | |
import Network.Format.LLSD | |
import System.Environment | |
main = do | |
[path, threads, reads] <- getArgs | |
let nthreads = read threads | |
qs <- newQSem 0 | |
replicateM_ nthreads $ do | |
forkIO $ do | |
replicateM_ (read reads) $ do | |
bs <- B.readFile path | |
case parseXML bs of | |
Left err -> print err | |
Right p -> print p | |
signalQSem qs | |
replicateM_ nthreads $ waitQSem qs | |
putStrLn "done" |
Author
bos
commented
Sep 1, 2010
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment