[Haskell-cafe] Printing of asynchronous exceptions to stderr

Bas van Dijk v.dijk.bas at gmail.com
Wed Nov 10 09:32:25 EST 2010

On Wed, Nov 10, 2010 at 2:39 PM, Mitar <mmitar at gmail.com> wrote:
>> Strange. It would help if you could show more of of your code.
> I am attaching a sample program which shows this. I am using 6.12.3 on
> both Linux and Mac OS X. And I run this program with runhaskell
> Test.hs. Without "throwIO ThreadKilled" it outputs:
> Test.hs: MyTerminateException
> MVar was successfully taken
> With "throwIO ThreadKilled" is as expected, just:
> MVar was successfully taken
> So MVar is filled. What means that thread gets exception after that.
> But there is nothing after that. ;-) (At least nothing visible.)

This is really interesting. Presumably what happens is that an
exception is indeed thrown and then raised in the thread after the
final action. Now if you synchronously throw an exception at the end
it looks like it's raised before the asynchronous exception is raised.

Hopefully one of the GHC devs (probably Simon Marlow) can confirm this
behavior and shed some more light on it.


More information about the Haskell-Cafe mailing list