It is important to note that a process only dies if the associated process ends for a reason other than โnormal,โ which means that a process that simply ends execution does not kill the processes associated with it. (source http://www.erlang.org/doc/reference_manual/processes.html#id204170 ) I think this is an important aspect of Erlang that should not be misinterpreted.
The following source code shows this:
1> spawn( 1> fun() -> 1> io:format("outer ~p~n", [self()]), 1> spawn_link( 1> fun () -> 1> io:format("inner ~p~n", [self()]), 1> receive 1> Msg -> io:format("received ~p~n", [Msg]) 1> end 1> end) 1> end). outer <0.37.0> <0.37.0> inner <0.38.0> 2> is_process_alive(pid(0,37,0)). false 3> pid(0,38,0) ! test. received test test 4>
You can see that the caller <0.37.0> is not working, but the process <0.38.0> is still present, waiting for the message.
In any case, the supervisor will not end when the caller ends, as the supervisor outputs the output signals. Of course, if it is not programmed for this. But I studied the source code and could not find it, but, alas, my analysis may have been too superficial.
Are you lucky with this? I will try to run some tests and see if I can understand what is going on.
source share