<div dir="ltr"><div>Hmm... here is my updated code, but the exit that comes via a link does not seem to get trapped!<br><a href="http://bin.cakephp.org/view/936550339">http://bin.cakephp.org/view/936550339</a><br><br></div>
This is what happens:<br><a href="http://bin.cakephp.org/view/554367077">http://bin.cakephp.org/view/554367077</a><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jan 12, 2014 at 7:48 PM, Bob Ippolito <span dir="ltr"><<a href="mailto:bob@redivi.com" target="_blank">bob@redivi.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">When two processes are linked, failures (abnormal exits) propagate from one to the other, ensuring that both die. This is not done by way of messages, but by an exit signal. These EXIT messages are only sent to processes that are trapping exits. See <a href="http://www.erlang.org/doc/reference_manual/processes.html#id83186" target="_blank">http://www.erlang.org/doc/reference_manual/processes.html#id83186</a> and refer to "Receiving Exit Signals".<div>
<br></div><div>In your case, the code in one process fails, which causes the other process to fail, so it can't print anything because there is no more process and it never received an exit message. A solution to this problem would be to use the trap_exit process flag (as is the case with supervisors), or use a monitor instead of a link.<br>
<div><br></div><div>-bob</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Sun, Jan 12, 2014 at 4:36 PM, Yves S. Garret <span dir="ltr"><<a href="mailto:yoursurrogategod@gmail.com" target="_blank">yoursurrogategod@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div>Hello,<br><br></div>I've recently created the following two modules from a book:<br>
<a href="http://bin.cakephp.org/view/1356260281" target="_blank">http://bin.cakephp.org/view/1356260281</a><br>
<a href="http://bin.cakephp.org/view/13533081" target="_blank">http://bin.cakephp.org/view/13533081</a><br>
<br></div>Now, when I send Pid ! {moon, asdf}. I get the following output:<br>39> Pid ! {moon, w}.<br>Received the input and sending now.<br>Received the input to drop.<br>{moon,w}<br><br>=ERROR REPORT==== 12-Jan-2014::19:31:38 ===<br>
Error in process <0.162.0> with exit value: {badarith,[{drop,fall_velocity,2,[{file,"drop.erl"},{line,27}]},{drop,drop,0,[{file,"drop.erl"},{line,17}]}]}<br><br></div>Why am I not seeing this line run?<br>
io:format("FAILURE: ~p died because of ~p.~n~n", [Pid, Reason]);<br></div>
<br></div></div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">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></div>
</blockquote></div><br></div>