Skip to content

Instantly share code, notes, and snippets.

@benmills
Created September 18, 2011 18:59
Show Gist options
  • Save benmills/1225406 to your computer and use it in GitHub Desktop.
Save benmills/1225406 to your computer and use it in GitHub Desktop.
-module(echo).
-export([go/0]).
go() ->
Pid2 = spawn(fun() -> loop() end),
Pid2 ! {self(), hello},
receive
{Pid2, Msg} ->
io:format("P1 ~w~n",[Msg])
end,
Pid2 ! stop.
loop() ->
receive
{From, Msg} ->
From ! {self(), Msg},
loop();
stop -> true
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment