Last active
June 7, 2018 21:04
-
-
Save aaronice/43a12cc4b18abd4dc2d3eaaa648b87b2 to your computer and use it in GitHub Desktop.
Erlang Process Example
This file contains hidden or 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
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