
15 Apr
2007
15 Apr
'07
7:16 p.m.
On Apr 15, 2007, at 8:23 PM, Spencer Janssen wrote:
parSequence_ xs = do m <- newEmptyMVar mapM_ (\x -> forkIO x >> putMVar m ()) xs replicateM_ (length xs) (takeMVar m)
mapM_ above spawns (length xs) threads blocking on a single "lock", right? replicateM_ then makes sure that the lock is "unlocked" as many times as threads spawned, right? Since all the threads block on a single MVar how do they run in parallel? Thanks, Joel -- http://wagerlabs.com/