blob: ec46c4ba7393aa98e3273e44fac236304e30830f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
module Main where
-- Test thread creation.
-- (from: Einar Wolfgang Karlsen <ewk@Informatik.Uni-Bremen.DE>)
import Control.Concurrent
main :: IO ()
main = do
mvar <- newEmptyMVar
let
spawner :: (IO () -> IO ThreadId) -> Int -> IO ()
spawner c 0 = putMVar mvar ()
spawner c n = do { c (spawner c (n-1)); return ()}
spawner forkIO 100000
takeMVar mvar
putStr "done"
|