[erlang-questions] Noob question: Need some help to limit process spawing
Edward Halls
ehalls@REDACTED
Sun Aug 16 15:37:09 CEST 2015
Perhaps some better syntax highlighting can help you spot this in the
future.
A good ide will also tell you when there are unused variables.
On 16 Aug 2015 2:22 pm, "Robert Raschke" <rtrlists@REDACTED> wrote:
> 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
>>
>>
> _______________________________________________
> 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/c6975268/attachment.htm>
More information about the erlang-questions
mailing list