Using links

One way to detect the crash of a process is through the use of links. When two processes are linked, and one exits, the other one will receive an exit signal, which notifies us that a process has crashed. One link always contains two processes, and the connection is bidirectional. One process may be linked to an arbitrary number of other processes, and there's no predefined limit in the system to the number of created links.

Besides the PID of the crashed process, the exit signal also contains the exit reason, which is an arbitrary term that describes the reason for the termination of the process. If the termination is a normal one, which means that the spawned process has finished its execution, the exit reason is :normal. By ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.