summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-08-10 12:54:57 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-08-10 12:54:57 +0100
commit47f3113644fa8bb1d63e37474e35059d48d1a12d (patch)
tree3a0faee072062679cb1fdc2656bb3afbb11fa7c6
parente5f4b173f598d084a9796b16544cff6c1846ccbf (diff)
parent0a81f9e6fb0c02073ccfea530edaf4cd2081ff40 (diff)
downloadrabbitmq-server-git-47f3113644fa8bb1d63e37474e35059d48d1a12d.tar.gz
Merging bug 23095 into bug 15930
-rw-r--r--src/supervisor2.erl33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl
index 5cb2c301b4..117adde2a8 100644
--- a/src/supervisor2.erl
+++ b/src/supervisor2.erl
@@ -680,10 +680,13 @@ shutdown(Pid, brutal_kill) ->
ok ->
exit(Pid, kill),
receive
- {'DOWN', _MRef, process, Pid, killed} ->
- ok;
{'DOWN', _MRef, process, Pid, OtherReason} ->
- {error, OtherReason}
+ case OtherReason of
+ killed -> ok;
+ normal -> ok;
+ noproc -> ok;
+ _ -> {error, OtherReason}
+ end
end;
{error, Reason} ->
{error, Reason}
@@ -695,12 +698,12 @@ shutdown(Pid, Time) ->
ok ->
exit(Pid, shutdown), %% Try to shutdown gracefully
receive
- {'DOWN', _MRef, process, Pid, Reason} ->
- case Reason of
- normal -> ok;
+ {'DOWN', _MRef, process, Pid, OtherReason} ->
+ case OtherReason of
shutdown -> ok;
+ normal -> ok;
noproc -> ok;
- _ -> {error, Reason}
+ _ -> {error, OtherReason}
end
after Time ->
exit(Pid, kill), %% Force termination.
@@ -727,15 +730,13 @@ monitor_child(Pid) ->
%% If the child dies before the unlik we must empty
%% the mail-box of the 'EXIT'-message and the 'DOWN'-message.
{'EXIT', Pid, Reason} ->
- receive
- {'DOWN', _, process, Pid, _} ->
- case Reason of
- normal -> ok;
- shutdown -> ok;
- noproc -> ok;
- _ -> {error, Reason}
- end
- end
+ case Reason of
+ normal -> ok;
+ _ -> receive
+ {'DOWN', _, process, Pid, _} ->
+ {error, Reason}
+ end
+ end
after 0 ->
%% If a naughty child did unlink and the child dies before
%% monitor the result will be that shutdown/2 receives a