[erlang-questions] erlang:exit/1 and erlang:exit/2

Tony Rogvall tony@REDACTED
Tue Jul 29 23:11:10 CEST 2014


On 29 jul 2014, at 21:19, Leo Liu <sdl.web@REDACTED> wrote:

> Hi there,
> 
Hello.

> Could someone help me understand the implementation of erlang:exit/1?
> 
>  BIF_RETTYPE exit_1(BIF_ALIST_1)
>  {
>      BIF_P->fvalue = BIF_ARG_1;  /* exit value */
>      BIF_ERROR(BIF_P, EXC_EXIT);
>  }
> 
> which is pretty simple and I am not sure how it propagates the exit
> signal. erlang:exit/2 on the contrary is full of details.
> 

BIFs with one (and more) argument are called from emulator loop in beam_emu.c
(R17 source)
beam_emu.c line 2779 in opcode "call_bif_e"
and line 3571 in opcode "apply_bif"
and line 2610 in "i_gc_bif1_jIsId"

and the rest is just a matter of reading code.
Hint. The function handler_error may be a good start to look in.

Have fun :-)

/Tony

> Thanks,
> Leo
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

"Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix"



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


More information about the erlang-questions mailing list