Sunday, 25 August 2013

Killing a Haskell binary

Killing a Haskell binary

If I press Ctrl+C, this throws an exception (always in thread 0?). You can
catch this if you want - or, more likely, run some cleanup and then
rethrow it. But the usual result is to bring the program to a halt, one
way or another.
Now suppose I use the Unix kill command. As I understand it, kill
basically sends a (configurable) Unix signal to the specified process.
How does the Haskell RTS respond to this? Is it documented somewhere? I
would imagine that sending SIGTERM would have the same effect as pressing
Ctrl+C, but I don't know that for a fact...
(And, of course, you can use kill to send signals that have nothing to do
with killing at all. Again, I would imagine that the RTS would ignore,
say, SIGHUP or SIGPWR, but I don't know for sure.)

No comments:

Post a Comment