[erlang-questions] Some problem abount exit signal?
Sun Dec 5 19:49:56 CET 2010
2010/12/5 Frédéric Trottier-Hébert <>:
> I'm not sure this can entirely be a bug. See the following:
> 1> catch exit(hah).
> 2> catch exit(self(), hah).
> ** exception exit: hah
> In this case, exit/1 is trappable, while exit/2 is not. They already behave differently depending on whether they are 'internal' (exit/1) or 'external' (exit/2). I don't see it as too extravagant to have one kind of kill behaving differently than the other in that context.
That they behave differently here for me who caused it is completely
logical, exit/1 terminates me directly while exit/2 sends a signal to
myself. That they are caught by different means, try/catch versus
trap_exit, is therefore also logical.
We had a long discussion about this long ago and decided that they
should behave differently. Though I imagine we failed to write
anything down about this. :-( Sigh!
I was thinking more about the effect I have on *other* processes when
I send them a 'kill' signal. The effect depends on *how* I send them
signal and not on the signal: if I kill myself with 'kill' it is
trappable and affects them as any other non-'normal' signal while if I
send it to them with an exit/2 it is untrappable. I think other
processes should be affected in the same way if they get a 'kill'
signal irrespective of how I sent it to them.
More information about the erlang-questions