OTP Design Principles User's Guide, 中文
http://learnyousomeerlang.com/content
敲命令支持tab提示, 这个不错
一个问题: 进程Pa中新建进程Pb,link,Pa直接退出,Pb收不到退出消息, 但Pa延迟一段时间退出,则pb可以接受到退出消息。可能是因为Pb还没来得及执行process_flag
start() ->
Pa = self(),
Pb = spawn(?MODULE, loop, []),
link(Pb),
receive
after 0 ->
exit(abnormal)
end.
loop() ->
process_flag(trap_exit, true),
receive
{'EXIT', From, Reason} ->
io:format("~p exit,reason ~p~n", [From, Reason])
end.