Why should I monitor processes and not just link and trap exits?

时间:2016-02-12 21:21:46

标签: erlang

Besides avoiding propagated kills, is there any advantage to monitoring over just trapping exits?

2 个答案:

答案 0 :(得分:8)

与陷阱退出不同,监控允许您轻松地关注尚未生成的流程,而无需捕获退出。此外,链接是双向的,所以如果你链接到某个进程但你先死了而且它没有捕获退出,它也会死掉。监控可防止这种意外耦合。

答案 1 :(得分:1)