Skip to content

Instantly share code, notes, and snippets.

@lorn
Created February 10, 2012 17:45
Show Gist options
  • Save lorn/1791202 to your computer and use it in GitHub Desktop.
Save lorn/1791202 to your computer and use it in GitHub Desktop.
Problem with ring in erlang :/
-module(ring).
-export([start/1,start_proc/2]).
start(Num) ->
start_proc(Num, self()).
start_proc(0,Pid) ->
Pid ! ok;
start_proc(Num, Pid) ->
NPid = spawn(ring, start_proc, [Num -1, Pid]),
NPid ! ok,
receive
ok -> ok
end.
Eshell V5.8.3 (abort with ^G)
1> c(ring).
{ok,ring}
2> timer:tc(ring,start,[1000]).
=ERROR REPORT==== 10-Feb-2012::15:45:35 ===
Error in process <0.38.0> with exit value: {undef,[{ring,start_proc,[999,<0.31.0>]}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment