1 Matching Annotations
- Aug 2022
-
elixir-lang.org elixir-lang.org
-
Links are bi-directional. If you link two processes and one of them crashes, the other side will crash too (unless it is trapping exits). A monitor is uni-directional: only the monitoring process will receive notifications about the monitored one. In other words: use links when you want linked crashes, and monitors when you just want to be informed of crashes, exits, and so on.
link 是双向的,如果你 link 两个进程,一个进程 crash 会导致另一个进程也 crash(除非它阻止退出?)。monitor 是单项的,只有正在监听的进程会收到被监听进程的消息。换句话说,当你希望绑定 crashed 关系,使用 link。 当你希望收到crash,exit 等消息时,使用 monitor
-