[Haskell-cafe] Re: throwTo & block statements considered harmful

Chris Kuklewicz haskell at list.mightyreason.com
Fri Dec 8 12:19:37 EST 2006


Program A and B got word wrapped by mistake...damn it.

Program A
> loop = block (print "alive") >> loop
>
> main = do tid <- forkIO loop
>           threadDelay 1
>           killThread tid

the above print "alive" forever while killThread stays blocked.

Program B
> loop = block (print "alive") >> loop >> yield
>
> main = do tid <- forkIO loop
>           threadDelay 1
>           killThread tid

the above prints "alive" about twice before killThread succeeds.


More information about the Haskell-Cafe mailing list