[erlang-questions] Noob question: Need some help to limit process spawing

Robert Raschke rtrlists@REDACTED
Sun Aug 16 15:14:13 CEST 2015


Could be the typo? Value2 vs Val2.
On Aug 16, 2015 12:44 PM, "avinash D'silva" <evnix.com@REDACTED> wrote:

> Hi,
>
> I have these lines code:
>
>  timer:apply_after(5*1000,mymodule,myfunction,[Value]),
>  timer:apply_after(5*1000,mymodule,myfunction,[Value]),
>  timer:apply_after(5*1000,mymodule,myfunction,[Value]),
>  timer:apply_after(5*1000,mymodule,myfunction,[Value]),
>  timer:apply_after(5*1000,mymodule,myfunction,[Value]),
>
> "myfunction" looks like this:
> myfunction(Value)->
>
> Val2=iolist_to_binary([Value,"_P"]),
>
> case pg2:get_members(Value2) of
>
>         [] ->
>             {ok,P}=mymodule:start_link(),
>             pg2:join(Value2,P2),
>             gen_server:call(P2,{push,Msg});
>         Otherwise ->
>             [Px|_]=Otherwise,
>             gen_server:call(Px,{push,Msg})
>       end,
>
> the problem is instead of creating a single process of mymodule.
> there are 5 processes, as time taken to register the process is more,
>
> Any solution to this problem?
>
>
> Regards,
> Avinash D' Silva
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150816/33d10662/attachment.htm>


More information about the erlang-questions mailing list