Skip to content

Instantly share code, notes, and snippets.

@aaronice
Last active June 7, 2018 21:04
Show Gist options
  • Save aaronice/43a12cc4b18abd4dc2d3eaaa648b87b2 to your computer and use it in GitHub Desktop.
Save aaronice/43a12cc4b18abd4dc2d3eaaa648b87b2 to your computer and use it in GitHub Desktop.
Erlang Process Example
launch() ->
register(echo, spawn(demo, echo, [])).
echo() ->
receive
{Pid, Msg} ->
Pid ! Msg,
echo()
end.
% Handle Timeouts
flush() ->
receive
_ -> flush()
after 0 ->
ok
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment