id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
5784,Forked thread running infinite loop blocks other threads from running,joeyadams,,"When I compile the following under GHC 7.2.2 with -O1 or -O2, it spins in the forked thread's infinite loop.  The forked thread does not yield control to the main thread:

{{{
import Control.Concurrent
import Control.Monad

main :: IO ()
main = do
    tid <- forkIO $ forever $ return ()
    putStrLn $ ""Forked "" ++ show tid
}}}

This happens up even if I compile with -threaded -rtsopts, use +RTS -N2, and use forkOS instead of forkIO.

The problem goes away if I disable optimization.  It also goes away if I stick a yield :: IO () call in the loop.",bug,closed,normal,,Runtime System,7.2.2,duplicate,,leon.p.smith@… mcallister.keegan@…,Linux,x86_64 (amd64),Incorrect result at runtime,Unknown,,,,
