[erlang-questions] Why is the spawn_link not working?

Bob Ippolito bob@REDACTED
Mon Jan 13 01:48:46 CET 2014

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
http://www.erlang.org/doc/reference_manual/processes.html#id83186 and refer
to "Receiving Exit Signals".

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.


On Sun, Jan 12, 2014 at 4:36 PM, Yves S. Garret

> Hello,
> I've recently created the following two modules from a book:
> http://bin.cakephp.org/view/1356260281
> http://bin.cakephp.org/view/13533081
> Now, when I send Pid ! {moon, asdf}. I get the following output:
> 39> Pid ! {moon, w}.
> Received the input and sending now.
> Received the input to drop.
> {moon,w}
> =ERROR REPORT==== 12-Jan-2014::19:31:38 ===
> 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}]}]}
> Why am I not seeing this line run?
> io:format("FAILURE: ~p died because of ~p.~n~n", [Pid, Reason]);
> _______________________________________________
> 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/20140112/b64c195f/attachment.htm>

More information about the erlang-questions mailing list