diff options
Diffstat (limited to 'testsuite/tests/concurrent/should_run/conc004.hs')
-rw-r--r-- | testsuite/tests/concurrent/should_run/conc004.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/concurrent/should_run/conc004.hs b/testsuite/tests/concurrent/should_run/conc004.hs new file mode 100644 index 0000000000..ec46c4ba73 --- /dev/null +++ b/testsuite/tests/concurrent/should_run/conc004.hs @@ -0,0 +1,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" |