Skip to content

Instantly share code, notes, and snippets.

@yehohanan7
Created June 11, 2014 12:30
Show Gist options
  • Save yehohanan7/768e6bd70a45a702592d to your computer and use it in GitHub Desktop.
Save yehohanan7/768e6bd70a45a702592d to your computer and use it in GitHub Desktop.
defmodule Server do
use GenServer.Behaviour
def start_link() do
:gen_server.start_link(__MODULE__, [], [])
end
end
defmodule Supervisor do
use Supervisor.Behaviour
def start_link do
:supervisor.start_link({:local, :my_sup}, __MODULE__, [])
end
def init(_) do
supervise([], strategy: :one_for_one)
end
def start_child() do
:supervisor.start_child(:my_sup, worker(Server, [], []))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment