[erlang-questions] Get grandchild pid when using nested supervisors?

Fred Hebert mononcqc@REDACTED
Tue Sep 30 17:46:39 CEST 2014


Rather than going that way there's the option of passing a callback
function, say:

    Target = self(),
    WhenReady = fun() -> Target ! {self(), ready} end,
    {ok, _SupPid} = start_child_chain_think(M, F, Args ++ [WhenReady]),
    receive
        {ChildPid, ready} -> ...
    end.

which at this point lets you get something without assumptions of the
supervision structure. On the other hand, the child in Y now has to know
it has to call a given callback to report to a parent when it's ready.

Regards,
Fred.

On 09/30, Vance Shipley wrote:
> On Mon, Sep 29, 2014 at 9:40 PM, Roger Lipscombe <roger@REDACTED>
> wrote:
> >
> > Calling supervisor:start_child(A, []) returns {ok, BPid}, where I
> > really want WPid. What's a sensible way to get hold of it?
> >
> 
> {ok, BPid} = supervisor:start_child(A, []),
> [{_, WPid, _, _}] = supervisor:which_children(BPid)
> 
> -- 
>      -Vance

> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list