[erlang-questions] Exit signals are funny things

Robert Virding rvirding@REDACTED
Fri May 5 13:27:09 CEST 2017


Sigh, that means someone has been "thinking".

Robert


On 3 May 2017 at 18:05, Ben Murphy <benmmurphy@REDACTED> wrote:

> 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
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170505/e13f6b00/attachment.htm>


More information about the erlang-questions mailing list