Documentation
Self-resetting barrier. barrier
blocks until a specified
number of threads have reached it, and then they are all allowed to
run. The barrier is then reset so that a further count
threads
can block on it. Typical usage is:
do b <- barrier 3 forkIO $ b >> putStrLn "1" -- blocked forkIO $ b >> putStrLn "2" -- blocked forkIO $ b >> putStrLn "3" -- all three threads run