running for long enough...
Andre W B Furtado
Wed, 25 Apr 2001 15:45:24 -0300
Actually, my version of the program would halt and print the "SWITCHED!"
message if it changed from "a"s to "b"s. But that's ok, I understood why
this example won't work well in GHC, but isn't it too disappointing that the
"Haskell Concurrent basic example for beginners" is not working well?
----- Original Message -----
From: Simon Marlow <firstname.lastname@example.org>
To: Andre W B Furtado <email@example.com>; <firstname.lastname@example.org>
Cc: <email@example.com>; <firstname.lastname@example.org>
Sent: Wednesday, April 25, 2001 7:57 AM
Subject: RE: running for long enough...
> > 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
> <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.