Native Threads in the RTS

Simon Marlow
Tue, 3 Dec 2002 11:03:19 -0000

> 2. It seems perfectly reasonable to want to have the Haskell=20
> called-back code throw an exception that is caught by the Haskell code

> that called out to foreign code.  "Reusing" the Haskell thread is
> necessary  (though not sufficient) to achieve such behavior.

This is a particularly tricky problem, and I prefer to leave it up to
the programmer to handle such things.  Propagating the exception to the
original (Haskell) caller automatically is unlikely to be the right
thing to do, because the foreign code will almost certainly want to do
some clean up.

If the foreign language supports exceptions then it is conceivable that
we could turn a Haskell exception into a foreign exception (and
vice-versa), but for plain C I think we should leave well alone.