Permalink
Browse files

added PoolsSup

  • Loading branch information...
davidsulc committed Sep 7, 2018
1 parent da35320 commit f67c087e348e6470d4b63f76aa7bd14f59c364e7
Showing with 22 additions and 17 deletions.
  1. +1 −16 lib/pool_toy.ex
  2. +1 −1 lib/pool_toy/application.ex
  3. +17 −0 lib/pool_toy/pools_sup.ex
  4. +3 −0 mix.exs
View
@@ -1,18 +1,3 @@
defmodule PoolToy do
@moduledoc """
Documentation for PoolToy.
"""
@doc """
Hello world.
## Examples
iex> PoolToy.hello
:world
"""
def hello do
:world
end
defdelegate start_pool(args), to: PoolToy.PoolsSup
end
@@ -3,7 +3,7 @@ defmodule PoolToy.Application do
def start(_type, _args) do
children = [
{PoolToy.PoolSup, [name: :poolio, worker_spec: Doubler, size: 3]}
PoolToy.PoolsSup
]
opts = [strategy: :one_for_one]
View
@@ -0,0 +1,17 @@
defmodule PoolToy.PoolsSup do
use DynamicSupervisor
@name __MODULE__
def start_link(opts) do
DynamicSupervisor.start_link(__MODULE__, opts, name: @name)
end
def start_pool(args) do
DynamicSupervisor.start_child(@name, {PoolToy.PoolSup, args})
end
def init(_opts) do
DynamicSupervisor.init(strategy: :one_for_one)
end
end
View
@@ -15,6 +15,9 @@ defmodule PoolToy.MixProject do
def application do
[
mod: {PoolToy.Application, []},
registered: [
PoolToy.PoolsSup
],
extra_applications: [:logger]
]
end

0 comments on commit f67c087

Please sign in to comment.