Created
May 7, 2014 15:43
-
-
Save zacksiri/fd40c10194716717969c 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 Bank do | |
use Application.Behaviour | |
# See http://elixir-lang.org/docs/stable/Application.Behaviour.html | |
# for more information on OTP Applications | |
def start(_type, _args) do | |
Bank.Supervisor.start_link | |
end | |
def start do | |
await | |
end | |
def await do | |
receive do | |
{:check_balance, pid} -> divulge_balance(pid) | |
end | |
await | |
end | |
def divulge_balance(pid) do | |
send(pid, {:balance, 0}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment