Question

I see from the Erlang docs that supervisor:start_child can return two different non-error results: {ok, Child} and {ok, Child, Info}. Where does this Info get set? Is it different for simple_one_for_one sups as opposed to others? I haven't been able to find an example / documentation on this...

Was it helpful?

Solution

Info comes from the function that starts the child process (as given in the child specification in the supervisor). Most of the time, that function will eventually call gen_server:start_link/4 which only returns {ok, Pid} and never {ok, Pid, Info}, so that case only applies when you have a custom function for spawning the process, probably using the functions in the proc_lib module.

Processes that don't use a pre-defined behaviour are called "special processes" and are described in the OTP Design Principles User's Guide.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top