[Haskell] Strange behaviour of forkIO threads

Maurizio Monge maurizio.monge at gmail.com
Sat May 13 17:37:27 EDT 2006


Hi, i used forkIO to write a 'por' (parallel or) implementation
(just a proof of concept), arguments are evaluated in different
threads and as soon as one of the threads returns true the other
thread is killed and true is returned.
If both threads return false the result of the computation is false.

I have been doing a few tests and looks like that in some cases
the function that do not terminate (that i used to test the por
correctness) seam not be preempted, and thus the program do not
terminate.
The very strange thing is that the program (that i am attaching)
works as expected if it is compiled with -O, but hangs if compiled
without optimization!
Any idea?
Thanks

-- 
Ciao
Maurizio

"Well we all shine on
Like the moon and the stars and the sun" (John Lennon)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: por.hs
Type: text/x-haskell
Size: 3725 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell/attachments/20060513/a061c132/por.bin


More information about the Haskell mailing list