forkIO and not -threaded
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Fri Jul 28 21:57:22 EDT 2006
On Sat, 2006-07-29 at 01:29 +0100, Neil Mitchell wrote:
> Hi,
>
> main = do
> forkIO $ print "yes"
> print "done"
>
> Compiled without -threaded, on 6.2.2 gives
>
> "yes"
> "done"
>
> on 6.4.2
>
> "done"
>
> Seems the semantics of forkIO in this case has changed completely?
Actually what changed is whether all threads have to finish or just the
main thread.
So what happens now with your code is that the main thread terminates
the whole program before the other thread gets a chance to run.
If you want to wait for a thread to terminate you can do that
explicitly.
Duncan
More information about the Glasgow-haskell-bugs
mailing list