blob: 4a04211824428655af3d68574ac3046d83c0100e (
plain)
1
2
3
4
5
6
7
8
9
|
import Control.Concurrent
main = do
m <- newEmptyMVar
end <- newEmptyMVar
forkIO (sequence_ [ putMVar m () | _ <- [1 .. 10000] ])
forkIO (sequence_ [ takeMVar m | _ <- [1 .. 10000] ] >> putMVar end ())
takeMVar end
|