10 Sep
2002
10 Sep
'02
8:17 p.m.
In FFI code you have to be more careful [about killing threads], however.
It's clear there's a bunch of bad things could happen here - but not obvious what does happen.
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
8530
Age (days ago)
8530
Last active (days ago)
0 comments
1 participants
participants (1)
-
Simon Marlow