aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/supervisor.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-04-18 15:14:36 +0200
committerMicael Karlberg <[email protected]>2011-04-18 15:14:36 +0200
commit5af51d9dcb60487e4fcc87353fe0e150c0ba9eed (patch)
tree95eb7adb0edba96eb3fc362a519fb1508cb477ec /lib/stdlib/src/supervisor.erl
parentd621b2cdd09adcc38bd6d482ae6c4f87e22cb1e8 (diff)
parent23906a01725f4494b8816c242926d08aeca0ef67 (diff)
downloadotp-5af51d9dcb60487e4fcc87353fe0e150c0ba9eed.tar.gz
otp-5af51d9dcb60487e4fcc87353fe0e150c0ba9eed.tar.bz2
otp-5af51d9dcb60487e4fcc87353fe0e150c0ba9eed.zip
Merge branch 'dev' into bmk/snmp/agent/multi_engine_id_for_traps/OTP-9119
Diffstat (limited to 'lib/stdlib/src/supervisor.erl')
-rw-r--r--lib/stdlib/src/supervisor.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl
index 3c5800effa..368dc2e3e5 100644
--- a/lib/stdlib/src/supervisor.erl
+++ b/lib/stdlib/src/supervisor.erl
@@ -344,8 +344,12 @@ handle_call({delete_child, Name}, _From, State) ->
handle_call({terminate_child, Name}, _From, State) ->
case get_child(Name, State) of
{value, Child} ->
- NChild = do_terminate(Child, State#state.name),
- {reply, ok, replace_child(NChild, State)};
+ case do_terminate(Child, State#state.name) of
+ #child{restart_type = temporary} = NChild ->
+ {reply, ok, state_del_child(NChild, State)};
+ NChild ->
+ {reply, ok, replace_child(NChild, State)}
+ end;
_ ->
{reply, {error, not_found}, State}
end;
@@ -817,8 +821,12 @@ state_del_child(Child, State) ->
NChildren = del_child(Child#child.name, State#state.children),
State#state{children = NChildren}.
+del_child(Name, [Ch|Chs]) when Ch#child.name =:= Name, Ch#child.restart_type =:= temporary ->
+ Chs;
del_child(Name, [Ch|Chs]) when Ch#child.name =:= Name ->
[Ch#child{pid = undefined} | Chs];
+del_child(Pid, [Ch|Chs]) when Ch#child.pid =:= Pid, Ch#child.restart_type =:= temporary ->
+ Chs;
del_child(Pid, [Ch|Chs]) when Ch#child.pid =:= Pid ->
[Ch#child{pid = undefined} | Chs];
del_child(Name, [Ch|Chs]) ->