25 Apr
2001
25 Apr
'01
10:57 a.m.
About the program below, someone (I think Simon Marlow) said that if I run it for long enough, I'll see "a"s rather than "b"s. I would like to know for how long I will have to wait, since 2 hours were not enough to see it switching from "b"s to "a"s.
main = forkIO a >> b where a = putStrLn "a" >> a b = putStrLn "b" >> b
Did you watch it continuously for two hours? It might have changed quicky to "a"s and back again without you noticing. Watch it very carefully. <mischevous grin> :) But seriously, don't waste your time on this example. It just doesn't work too well with GHC, because of the contention between the two threads both trying to access standard output. Cheers, Simon