
30 Jun
2012
30 Jun
'12
11:24 a.m.
Your application is exiting before your forkIOs get a chance to execute. Instead of forkIO $ do ... forkIO $ do ... forkIO $ do ... use something like finished <- newEmptyMVar forkIO $ do ... putMVar finished () forkIO $ do ... putMVar finished () forkIO $ do ... putMVar finished () replicateM_ 3 (takeMVar finished) Doing so will avoid your program to exit until all threads have finished. Note that the code above is extremely fragile: doesn't handle exceptions, you have to manually specify the number of threads that you opened, etc. These are abstracted by some libraries on Hackage that you may use later for Real World Code (TM). Cheers, =) -- Felipe.