blob: 2ff1ccb8c89fec3efbecbfc4d88d4905b86c0744 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import Scheduler
import Foreign
import Foreign.C
import System.Random
import Control.Concurrent
expensive = f (500 :: Int)
where f 0 = stop
f n = do
r <- atom $ getStdRandom (randomR (0,99::Int))
r `seq` f $! n-1
main = do
m <- newEmptyMVar
forkIO (do
runTIO $ map (\x->expensive) [1..500]
putMVar m ())
takeMVar m
|