diff options
author | Ingela Anderton Andin <[email protected]> | 2011-04-06 09:28:26 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2011-04-06 09:28:26 +0200 |
commit | d8dcd70f386de09109ca1f6f817a381cd1387769 (patch) | |
tree | 333fa49b04fb60a758e82ac23035e83a737ec3ab /lib/stdlib/src | |
parent | 79698f6f214283e34f8e0893c90716f503a723f2 (diff) | |
parent | 12b417a1cb28799f78ec911bc1dc9dfdb0af6fea (diff) | |
download | otp-d8dcd70f386de09109ca1f6f817a381cd1387769.tar.gz otp-d8dcd70f386de09109ca1f6f817a381cd1387769.tar.bz2 otp-d8dcd70f386de09109ca1f6f817a381cd1387769.zip |
Merge branch 'ia/stdlib/supervisor-saves-temporary-child-specs/OTP-9167' into dev
* ia/stdlib/supervisor-saves-temporary-child-specs/OTP-9167:
Completed bug fix "temporary child specs should not be kept when child terminates" and improved test suite
Fix issue with temporary children introduced by OTP-9064
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/supervisor.erl | 12 |
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]) -> |