> Maybe this is by design, but in case it isn't: I was a little
> suprprised when I came across this behavior of ghci:
> 
>    ghci
>    ...  GHC Interactive, version 5.04.1, for Haskell 98. ...
> 
>    Prelude> :m Concurrent
>    Prelude Concurrent> let loop c = putChar c >> loop c
>                        in forkIO (loop 'a') >> (loop 'z')
>    
> zazazazazazazazazazazazazazazazazazazazazazazazazazazazazazaza
> zazazazazazaza
>    
> zazazazazazazazazazazazazazazazazazazazazazazazazazazazazazaza
> zazazazazazaza
>    
> zazazazazazazazazazazazazazazazazazazazazazazazazazazazazazaza
> zazazazazazaza
>    Interrupted.
>    aPrelude Concurrent> sum [1..100]
>    aaaaaaaaaaaaa5050
>    aPrelude Concurrent>  1+2
>    aaaaaaaa3

This is really a design choice: there is no inter-thread structure other
than what you program yourself, there are no "process groups", and
pressing ^C sends an exception to the main thread only.  We don't
currently have a way for a Haskell program to get access to *all* the
current threads running, so there's no easy way for GHCi to stop
extraneous threads when ^C is received.

It's really a bug that the other threads are suspended when the prompt
appears (but it might also be called a feature: terminating GHCi after
your example might be difficult otherwise!).

Cheers,
        Simon
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to