[erlang-questions] Strange behaviour of exit(kill)

zxq9 <>
Wed Oct 7 03:33:24 CEST 2015

On Wednesday 07 October 2015 10:25:38 zxq9 wrote:

> or maybe it is that {'EXIT', Pid = self(), kill} *is* specifically untrappable by way of matching on self()?

That was too much to hope for:

1> P = spawn(fun Loop() -> receive M -> io:format("Got ~p~n", [M]), Loop() end end).
2> P ! {'EXIT', P, kill}.
Got {'EXIT',<0.1889.0>,kill}
3> P ! {'EXIT', P, blam}.
Got {'EXIT',<0.1889.0>,blam}
4> exit(P, kill).
5> P ! {'EXIT', P, blam}.

If it *did* turn out that matching {'EXIT', self(), kill} was untrappable I would just say "ah, that makes sense -- now I can understand the mechanism behind this without thinking about VM details". Instead it appears to be a case of mysterious activity underlying a message form that is semantically overloaded. And that stinks.


More information about the erlang-questions mailing list