Created
October 23, 2014 21:54
-
-
Save abhijitiitr/b1b6f32079b869fef046 to your computer and use it in GitHub Desktop.
This file contains 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
% c(spawner). | |
% c(conc_nif_caller). | |
% c(niftest). | |
% spawn(spawner,spawn_multiple_nif_callers,[10]). | |
-module(spawner). | |
-export([spawn_multiple_nif_callers/1]). | |
spawn_multiple_nif_callers(Val) -> | |
FinalPidList = lists:foldl(fun(Int_Pid, PidList) -> | |
Pid = spawn(conc_nif_caller, call_nif, []), | |
[{Int_Pid, Pid} | PidList] | |
end,[], lists:seq(1,Val)), | |
lists:foreach(fun(Elem) -> | |
{A, B} = Elem, | |
B ! A | |
end, FinalPidList). | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment