Hello Neil,

Thursday, April 15, 2010, 12:37:35 PM, you wrote:

> I find non-termination with a much simpler program than yours (GHC 6.12.1):
>    forkIO $ do putStrLn "Started thread"
>                forever $ return ()

ghc multithreading is actually cooperative: it switches only on memory
allocation. since almost any haskell code allocates, there is no
problem - it works like preemptive one. but sometimes this assumption
fails - with optimization enabled, your code doesn't allocate so there
are no chances for thread switching. replacing return () with
threadDelay call solves the problem


-- 
Best regards,
 Bulat                            mailto:bulat.zigans...@gmail.com

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to