[erlang-questions] Pass Name to Dynamic Supervisors

Samuel Elliott sam@REDACTED
Thu Sep 8 10:44:34 CEST 2011

I managed this when writing an OS erlang app recently.

in the supervisor:
and in the worker:

Essentially, the supervisor's `start_child/1` takes the callback module, and
adds a childspec to the supervisor. This childspec then calls down into the
worker's `start_link/1` which takes the same callback module name as an
argument, and starts a gen_server using itself. Yes, it sounds complicated,
but it's not really.


On Thu, Sep 8, 2011 at 3:09 AM, Christopher Wilson <wilsoncj1@REDACTED>wrote:

> Is there a way to pass a name/ID into the call to supervisor:start_child,
> more specifically to init()?  I'd like to specify the name of the worker or
> supervisor such that when I ran supervisor:which_children I could identify
> what's what.
> Also, I've tried [unsuccessfully] to dynamically create a child spec and
> add pass that in.  Are there any decent examples out there on how to do this
> outside of the man pages?
> Thank you.
> -Chris
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

Samuel Elliott
+44 (0)7891 993 664
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110908/215048f1/attachment.htm>

More information about the erlang-questions mailing list