<div dir="ltr">Sorry, it was just a typo.<div>The original question holds. </div><div><br></div><div>I was considering using a <b>Semaphore</b> to block the spawning of a new proccess with the help of ETS, but I fear performance issues.</div><div><br></div><div>Code with Fixed Typo:</div><div><br></div><div> timer:apply_after(5*1000,mymodule,myfunction,[Value]),<br></div><div><div> timer:apply_after(5*1000,mymodule,myfunction,[Value]),</div><div> timer:apply_after(5*1000,mymodule,myfunction,[Value]),</div><div> timer:apply_after(5*1000,mymodule,myfunction,[Value]),</div><div> timer:apply_after(5*1000,mymodule,myfunction,[Value]),</div><div><br></div><div>"myfunction" looks like this:</div><div>myfunction(Value)-></div><div><br></div><div>Val2=iolist_to_binary([Value,"_P"]),</div><div><br></div><div>case pg2:get_members(Val2) of</div><div> </div><div> [] -> </div><div> {ok,P}=mymodule:start_link(),</div><div> pg2:join(Val2,P2),</div><div> gen_server:call(P2,{push,Msg});</div><div> Otherwise -> </div><div> [Px|_]=Otherwise,</div><div> gen_server:call(Px,{push,Msg})</div><div> end, </div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 16, 2015 at 7:07 PM, Edward Halls <span dir="ltr"><<a href="mailto:ehalls@gmail.com" target="_blank">ehalls@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Perhaps some better syntax highlighting can help you spot this in the future.</p>
<p dir="ltr">A good ide will also tell you when there are unused variables.</p><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On 16 Aug 2015 2:22 pm, "Robert Raschke" <<a href="mailto:rtrlists@googlemail.com" target="_blank">rtrlists@googlemail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p>Could be the typo? Value2 vs Val2.<br>
</p>
<div class="gmail_quote">On Aug 16, 2015 12:44 PM, "avinash D'silva" <<a href="mailto:evnix.com@gmail.com" target="_blank">evnix.com@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>I have these lines code:</div><div><br></div><div><div> timer:apply_after(5*1000,mymodule,myfunction,[Value]),</div></div><div> timer:apply_after(5*1000,mymodule,myfunction,[Value]),<br></div><div> timer:apply_after(5*1000,mymodule,myfunction,[Value]),<br></div><div> timer:apply_after(5*1000,mymodule,myfunction,[Value]),<br></div><div> timer:apply_after(5*1000,mymodule,myfunction,[Value]),<br></div><div><br></div><div>"myfunction" looks like this:</div><div>myfunction(Value)-></div><div><div><br></div><div>Val2=iolist_to_binary([Value,"_P"]),</div><div><br></div><div>case pg2:get_members(Value2) of</div><div> </div><div> [] -> </div><div> {ok,P}=mymodule:start_link(),<br></div><div> pg2:join(Value2,P2),</div><div> gen_server:call(P2,{push,Msg});</div><div> Otherwise -> <br></div><div> [Px|_]=Otherwise,</div><div> gen_server:call(Px,{push,Msg})</div><div> end, </div></div><div><br></div><div>the problem is instead of creating a single process of mymodule.</div><div>there are 5 processes, as time taken to register the process is more,</div><div><br></div><div>Any solution to this problem?</div><div><br></div><div><br></div><div>Regards,</div><div>Avinash D' Silva</div>
</div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Powered B<span></span><span></span>y <a href="http://codologic.com" target="_blank">codologic</a></div>
</div>