Created
December 15, 2011 20:02
-
-
Save sleeptillseven/1482622 to your computer and use it in GitHub Desktop.
spawning a lot of processes
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
-module(ring). | |
-export([start/1]). | |
-export([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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Forgot to export the underlying function.