[erlang-questions 81] Re: [erlang-questions] otp/supervisor immediately goes to "shutdown"

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Mon Mar 28 13:59:44 CEST 2011


On Mon, Mar 28, 2011 at 13:42, Nick S <nick.sfx.1@REDACTED> wrote:
> Thanks Jesper, this all works now!
> Still one question. Is there a way for supervisor to know PIDs of worker
> processes, in this case

There are a couple of options:

If the process is singular in the system, you can register/2 it.

If the process is not singular, you can use a process registry to
store its pid() and have other processes look up the Pid in the
registry. gproc is one such registry, but you can also write one
yourself with ETS tables, or use the global register facility which
can map arbitrary terms to pid()'s (local registry can only map
atoms).

Finally, you can ask the supervisor: supervisor:which_children/1

-- 
J.



More information about the erlang-questions mailing list