Last active
October 24, 2017 17:50
-
-
Save shahryarjb/36f01b8d869d8f14c947640f45fd2bb8 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
defmodule Tasksups.Application do | |
# See https://hexdocs.pm/elixir/Application.html | |
# for more information on OTP Applications | |
@moduledoc false | |
use Application | |
# use Supervisor | |
def start(_type, _args) do | |
import Supervisor.Spec, warn: false | |
# List all child processes to be supervised | |
children = [ | |
# Starts a worker by calling: Tasksups.Worker.start_link(arg) | |
# {Tasksups.Worker, arg}, | |
supervisor(Task.Supervisor, [[name: Tasksups.TaskSupervisor, restart: :transient]]), | |
supervisor(Task.Supervisor, [[name: Tasksups.ConflyggsTaskSupervisor, restart: :transient]]) | |
] | |
# See https://hexdocs.pm/elixir/Supervisor.html | |
# for other strategies and supported options | |
opts = [strategy: :one_for_one, name: Tasksups.Supervisor] | |
Supervisor.start_link(children, opts) | |
end | |
end |
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 Tasksups.Conflyggs do | |
def hello do | |
Task.Supervisor.async_nolink Tasksups.ConflyggsTaskSupervisor, fn -> | |
:timer.sleep(10000) | |
IO.puts "hi Shahryar tavakkoli" | |
end | |
end | |
def by do | |
Task.Supervisor.async_nolink Tasksups.ConflyggsTaskSupervisor, fn -> | |
:timer.sleep(10000) | |
IO.puts "by Shahryar tavakkoli" | |
end | |
end | |
end |
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 Tasksups do | |
def hello do | |
Task.Supervisor.async_nolink Tasksups.TaskSupervisor, fn -> | |
:timer.sleep(10000) | |
IO.puts "hi Shahryar tavakkoli" | |
end | |
end | |
def by do | |
Task.Supervisor.async_nolink Tasksups.TaskSupervisor, fn -> | |
:timer.sleep(10000) | |
IO.puts "by Shahryar tavakkoli" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment