[erlang-questions] EPmail-0.1 released

Torben Hoffmann torben.lehoff@REDACTED
Mon Jan 31 09:17:14 CET 2011


>From the supervisor documentation:

*Important note on simple-one-for-one supervisors:* The dynamically created
child processes of a simple-one-for-one supervisor are not explicitly
killed, regardless of shutdown strategy, but are expected to terminate when
the supervisor does (that is, when an exit signal from the parent process is
received).


But as long as you stay with OTP components the child will have this
behaviour by default (as I read the manual).

I had an issue where the simple_one_for_one did not work, but I cannot
remember the details (sorry), it was just so painful that I have never used
the simple_one_for_one again but instead implemented a function
my_child_spec/* that returns a child spec that suits the problem at hand and
the started the child with supervisor:start_child/2.

One thing to note about the simple_one_for_one supervisors is that the
children do not get an id, so when you call supervisor:which_children/1 you
cannot tell them apart very easily.
I tend to give the children an id that makes it easy for me to debug a
running system, e.g., by putting something like a call reference in the id
term. That makes it easy to figure out with pid a specific process has and
then call sys:get_status/1 to get further information. Without an id for the
children it becomes guess work.

Cheers,
Torben


On Sat, Jan 29, 2011 at 09:28, Max Lapshin <max.lapshin@REDACTED> wrote:

> Of course!
>
> It is because You are starting second example of singleton =))
>
> simple_one_for_one is what you need.
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


-- 
http://www.linkedin.com/in/torbenhoffmann


More information about the erlang-questions mailing list