Concurrent Haskell (Ops...)

Tom Pledger Tom.Pledger@peace.com
Tue, 17 Apr 2001 15:24:39 +1200


Andre W B Furtado writes:
 :
 | import Concurrent
 | 
 | main :: IO()
 | main = let loop ch = putStr(ch) >> loop ch in
 |        forkIO (loop "a") >> loop "z"
 | 
 | But this program prints only 'z's, and no 'a's. I was surprised by
 | this, since GHC uses preemptive multitasking, not cooperative
 | multitasking. Does anyone knows what's going wrong?

By my count, this is now a TAQ (thrice asked question).  :-)

http://www.mail-archive.com/glasgow-haskell-users@haskell.org/msg01599.html