[erlang-questions] Exit signals are funny things

Ben Murphy benmmurphy@REDACTED
Wed May 3 18:05:40 CEST 2017


Well its a very deliberate decision by someone.

erts/emulator/beam/bif.c:

         erts_send_exit_signal(BIF_P,
                               BIF_P->common.id,
                               rp,
                               &rp_locks,
                               BIF_ARG_2,
                               NIL,
                               NULL,
                               BIF_P == rp ? ERTS_XSIG_FLG_NO_IGN_NORMAL : 0);

It sends ERTS_XSIG_FLG_NO_IGN_NORMAL if you are sending a signal to yourself.

On Wed, May 3, 2017 at 2:03 PM, 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
>



More information about the erlang-questions mailing list