Created
April 26, 2015 04:51
-
-
Save edubkendo/bb88522919a28190845a to your computer and use it in GitHub Desktop.
worker.ex loop
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 Metex.Worker do | |
def loop do | |
receive do | |
{sender_pid, location} -> | |
send(sender_pid, {:ok, temperature_of(location)}) | |
{sender_pid, _} -> # won't compile without knowing what the sender_pid is below | |
send(sender_pid, "Unknown message") | |
end | |
loop | |
end | |
# ... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment