Created
October 7, 2015 09:40
-
-
Save alco/5e78b968b84177b60030 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(1)> pid = spawn_link(fn -> receive do :foo -> :ok end end) | |
#PID<0.59.0> | |
iex(2)> monitor = Process.monitor(pid) | |
#Reference<0.0.6.73> | |
# Now make the spawned process go away | |
iex(4)> send(pid, :foo) | |
:foo | |
iex(5)> Process.alive?(pid) | |
false | |
# The current process' inbox now contains a DOWN message because it called Process.monitor() before | |
iex(7)> flush | |
{:DOWN, #Reference<0.0.6.73>, :process, #PID<0.59.0>, :normal} | |
:ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment