[erlang-questions] supervisor:start_child
Gregory Haskins
gregory.haskins@REDACTED
Mon May 2 19:17:23 CEST 2011
On 5/2/11 12:38 PM, Martin Dimitrov wrote:
> Thanks for the advise about the interface.
>
>> A normal (i.e. not simple_on_for_one) supervisor allows you to stop,
> restart and delete children processes, so it needs a way to identify
> them. Hence the id.
>
> Isn't the process id the natural choice for these purposes?
Its chicken and egg, though. The supervisor spawns the process and you
have to give it an ID to instruct it to start_child() in the first place.
>
> So there is no way to avoid the need of unique ids if using anything
> other than simple_one_for_one?
When I don't care, I just use erlang:now() for the ID. Sloppy, perhaps,
but it gets the job done.
Kind Regards,
-Greg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110502/abbdc069/attachment.bin>
More information about the erlang-questions
mailing list