Created
April 30, 2019 10:48
-
-
Save cybrox/1be651edce012d3d457e6da0e24544f2 to your computer and use it in GitHub Desktop.
ex-mag3.ex
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
defmodule Pragmatic do | |
def supervisor(worker) do | |
spawn_link(fn -> | |
Process.flag(:trap_exit, true) | |
worker_pid = spawn_link(worker) | |
receive do | |
{:EXIT, ^worker_pid, _} -> | |
supervisor(worker) | |
end | |
end) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment