logo       

Re: forkIO and not -threaded: msg#00105

lang.haskell.glasgow.bugs

Subject: Re: forkIO and not -threaded

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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise