<div>exit/1 and exit/2 are wildly different things. exit/1 is a local thing, much like erlang:error/1 and throw/1. They interact with the current stack, and you catch them with either 'catch' or 'try ... catch'.<br>

</div><div><br></div><div>exit/2 on the other hand, sends 'exit signls' to other processes. They can't be caught, unless you use trap_exit. In these cases, trap_exit can make a process basically unkillable, so a special one ('kill') exists that bypasses the issue.</div>

<div><br></div><div>When your process dies of reason 'kill' (either because I called exit(kill) or exit(self(), kill)), the reason is changed to 'killed' to avoid cascading failures of linked processes that trap exits, and the signal received is in fact 'killed', similar to 'exit(Pid, killed)' in some ways, although they operate differently.</div>

<div><br></div><div>Hopefully this makes it a bit clearer. I've got more complete explanations at <a href="http://learnyousomeerlang.com/errors-and-processes">http://learnyousomeerlang.com/errors-and-processes</a>, but it's a lengthy read for the question.</div>

<br><div class="gmail_quote">On Tue, Mar 6, 2012 at 2:18 PM, Shahrdad Shadab <span dir="ltr"><<a href="mailto:shahrdad1@gmail.com">shahrdad1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I am amazed by difference between the effects of exit (kill) and exit (PID,kill).<br><br>Assume PA and PB are two processes and PA has its trap_exit set to true.<br>When PB evaluates exit(kill), the process terminates but PA doesn't die and actually gets message {EXIT,PB,kill}.<br>


However When PB evaluates exit(PA,kill), PA dies right a way !<br><br>Will someone please explain the intention behind this behavior? (or I am missing something! <br><br>Thanks a lot<span class="HOEnZb"><font color="#888888"><br>

<br>-- <br>Software Architect & Computer Scientist<br>

</font></span><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br>