[erlang-questions] Exit signals are funny things

Brujo Benavides fernando.benavides@REDACTED
Wed May 3 15:09:51 CEST 2017


Furthermore…

1> Self = self().
<0.68.0>
2> spawn(fun() -> exit(Self, normal) end).
<0.71.0>
3> flush().
ok
4> self().
<0.68.0>
5> spawn(fun() -> exit(Self, not_normal) end).
** exception exit: not_normal
6> self().
<0.76.0>
7>

So, if some other process sends me a normal exit signal, it works as expected.

> On May 3, 2017, at 14:03, Robert Virding <rvirding@REDACTED> wrote:
> 
> So:
> 
> 1> Pid = spawn_link(fun() -> timer:sleep(infinity) end).
> <0.59.0>
> 2> exit(Pid, normal).
> true
> 3> flush().       
> ok
> 4> exit(Pid, die).
> ** exception exit: die
> 
> I spawn_link a process which is not trapping and send it the signal 'normal' which it ignores. As it should. I then send it the signal 'die' and it crashes. As it should.
> 
> Now:
> 
> 5> exit(self(), normal).
> ** exception exit: normal
> 
> Now I send myself the signal 'normal' and I die! So there is 'normal' and there is 'normal' depending on to whom I send it.
> 
> Where's the logic in that?
> 
> Robert
> 
> P.S. More to come
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170503/f2fc53a8/attachment.htm>


More information about the erlang-questions mailing list