summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-07-06 16:12:46 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-07-06 16:12:46 +0100
commit10ae11e5ebd14c39c38c5f2217d1f93e794373d2 (patch)
treeb60c56a53d5529aa19674269cd143c4de24f6782
parent0615a83e51fc2a981aba84b58ac35d37ce746c06 (diff)
downloadrabbitmq-server-git-10ae11e5ebd14c39c38c5f2217d1f93e794373d2.tar.gz
Ensure that a supervisor, when attempting to stop a process that turns out to be already stopped with either normal or shutdown, does not winge
-rw-r--r--src/supervisor2.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl
index 32cd9370cc..5f1ec54c80 100644
--- a/src/supervisor2.erl
+++ b/src/supervisor2.erl
@@ -614,6 +614,8 @@ shutdown(Pid, brutal_kill) ->
{'DOWN', _MRef, process, Pid, OtherReason} ->
{error, OtherReason}
end;
+ normal_shutdown ->
+ ok;
{error, Reason} ->
{error, Reason}
end;
@@ -635,6 +637,8 @@ shutdown(Pid, Time) ->
{error, OtherReason}
end
end;
+ normal_shutdown ->
+ ok;
{error, Reason} ->
{error, Reason}
end.
@@ -655,7 +659,12 @@ monitor_child(Pid) ->
{'EXIT', Pid, Reason} ->
receive
{'DOWN', _, process, Pid, _} ->
- {error, Reason}
+ case Reason of
+ normal -> normal_shutdown;
+ shutdown -> normal_shutdown;
+ {shutdown, _Terms} -> normal_shutdown;
+ _ -> {error, Reason}
+ end
end
after 0 ->
%% If a naughty child did unlink and the child dies before