Skip to content

Instantly share code, notes, and snippets.

@GeertVL-zz
Created July 3, 2012 05:49
Show Gist options
  • Save GeertVL-zz/3037945 to your computer and use it in GitHub Desktop.
Save GeertVL-zz/3037945 to your computer and use it in GitHub Desktop.
Erlang 8.11.2
-module(ring).
-export([clasp/0,shackle/1,send/1]).
clasp() ->
spawn(fun() -> loop([]) end).
shackle(Pid) ->
spawn(fun() -> loop(Pid) end).
send(Pid) ->
Pid ! {next}.
loop(Pid) ->
receive
{next} ->
io:format("Send request received"),
Pid ! {next},
loop(Pid)
end.
%CPid = ring:clasp().
%Pid1 = ring:shackle(CPid).
%Pid2 = ring:shackle(Pid1).
%Pid3 = ring:shackle(Pid2).
%Pid4 = ring:shackle(Pid3).
%Pid5 = ring:shackle(Pid4).
%ring:send(Pid5).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment