'interrupted' when exiting

Akio Takano tkn.akio at gmail.com
Wed Mar 6 01:57:44 CET 2013


[Resending to the list]

Thank you for your explanation.

On Mon, Mar 4, 2013 at 10:32 PM, Simon Marlow <marlowsd at gmail.com> wrote:
> The issue is this: when the main thread exits, the RTS starts shutting down,
> and it kills all the other threads.  If any of these threads were the result
> of an external in-call from C, then that call returns, with the status
> "Interrupted".  Now, if this was a foreign export or a foreign import
> "wrapper", then there is no provision for returning an error code to the
> caller, so the foreign export must either
>
>   a) kill the current OS thread
>   b) kill the whole process
>   c) sleep indefinitely
>
> Right now we do (b) I think.  Perhaps (a) would be better; at least that
> might fix your problem.

Would it make sense to make rts behave differently depending on
whether the process is going to be terminated? For example, could it
do (c) when shutdownHaskellAndExit() is being called, and do (b)
otherwise?

- Akio



More information about the Glasgow-haskell-users mailing list