Skip to content

Instantly share code, notes, and snippets.

@edubkendo
Created April 26, 2015 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edubkendo/bb88522919a28190845a to your computer and use it in GitHub Desktop.
Save edubkendo/bb88522919a28190845a to your computer and use it in GitHub Desktop.
worker.ex loop
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