Time out

Simon Marlow simonmar@microsoft.com
Tue, 10 Sep 2002 15:47:41 +0100


> > In FFI code you have to be more careful [about killing=20
> threads], however.
>=20
> It's clear there's a bunch of bad things could happen here - but not
> obvious what does happen.
>=20
> Does killing a thread that is calling a C function kill it immediately
> (i.e., before the call completes) or wait until the C function
> finishes?

The thread can only receive an exception while running Haskell code.
That means that in an 'unsafe' C call, the thread can't receive an
exception until the call returns, but a thread doing a 'safe' C call may
receive an exception if the call re-enters Haskell.  Either way, you
don't have to worry about being killed in the middle of C code, which
would be completely impossible to deal safely with.

Cheers,
	Simon