Skip to content

Instantly share code, notes, and snippets.

@pragdave
Created June 14, 2013 03:54
Show Gist options
  • Save pragdave/5779347 to your computer and use it in GitHub Desktop.
Save pragdave/5779347 to your computer and use it in GitHub Desktop.
import :timer, only: [ sleep: 1 ]
defmodule Link1 do
def sad_method do
sleep 500
exit(99)
end
def run do
spawn(Link1, :sad_method, [])
receive do
msg ->
IO.puts "MESSAGE RECEIVED: #{inspect msg}"
after 1000 ->
IO.puts "Nothing happened as far as I am concerned"
end
end
end
Link1.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment