[erlang-questions] Staring more than one instance of a gen_server
Ken Robinson
kenrobinsonster@REDACTED
Sat Oct 16 15:34:37 CEST 2010
Hi Ahmed,
Thanks for your reply.
I read that part of the documentation. I feel I want some less dynamic.
I read some of the gen_server doco
(http://www.erlang.org/doc/man/gen_server.html) where it referred to
the start_link function:
start_link(ServerName, Module, Args, Options) -> Result
...
ServerName = {local,Name} | {global,GlobalName}
I'm going to try changing the Id to the module name plus a number then
making the ServerName the same as that.
Ken.
{Id, StartFunc, Restart, Shutdown, Type, Modules} from the
On Fri, Oct 15, 2010 at 6:31 AM, Ahmed Omar <spawn.think@REDACTED> wrote:
> Hi Ken,
> It all depends on your purposes. If you want to start these processes as a
> part of a supervision tree, so you would probably like to use
> simple-one-for-one strategy and children dynamically
> supervisor:start_child(Sup, List)
> http://www.erlang.org/doc/design_principles/sup_princ.html#id67619
> On Thu, Oct 14, 2010 at 5:15 PM, Ken Robinson <kenrobinsonster@REDACTED>
> wrote:
>>
>> Hi All,
>> If I wanted to start more than one instance of a gen_server what is
>> the best practice? The gen_servers would be exactly the same except
>> for the seeding parameters. From what I've found I could use the child
>> spec and seed with specific names through the arguments like so:
>> start_link(PortNumber, MySpecialName) -> gen_server:start_link({local,
>> MySpecialName, ?MODULE, PortNumber, []).
>> Would that work?
>> --
>> regards,
>> Ken Robinson
>>
>> ________________________________________________________________
>> erlang-questions (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>>
>
>
>
> --
> Best Regards,
> - Ahmed Omar
> http://nl.linkedin.com/in/adiaa
> Follow me on twitter
> @spawn_think
>
--
regards,
Ken Robinson
Mob +61438681120
Home +61738523767
Work +61733063137
More information about the erlang-questions
mailing list