aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/global.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2011-11-14 13:49:35 +0100
committerHans Bolinder <[email protected]>2011-11-14 14:10:58 +0100
commit4db61fcf79516ff9cd6fd04c89376f063ccae7e8 (patch)
tree77ad0bbadc2096664d649f7896fe9a0882b39192 /lib/kernel/src/global.erl
parentfeb6c1dece891c7cb46c24bbdf9082c758c7830e (diff)
downloadotp-4db61fcf79516ff9cd6fd04c89376f063ccae7e8.tar.gz
otp-4db61fcf79516ff9cd6fd04c89376f063ccae7e8.tar.bz2
otp-4db61fcf79516ff9cd6fd04c89376f063ccae7e8.zip
Remove all use of global:safe_whereis_name/1
Calls to global:whereis_name/1 have been substituted for calls to global:safe_whereis_name/1 since the latter is not safe at all. The reason for not doing this earlier is that setting a global lock masked out a bug concerning the restart of supervised children. The bug has now been fixed by a modification of global:whereis_name/1. (Thanks to Ulf Wiger for code contribution.)
Diffstat (limited to 'lib/kernel/src/global.erl')
-rw-r--r--lib/kernel/src/global.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/kernel/src/global.erl b/lib/kernel/src/global.erl
index 7d15f8bf83..9e27f22a16 100644
--- a/lib/kernel/src/global.erl
+++ b/lib/kernel/src/global.erl
@@ -1235,7 +1235,15 @@ ins_name_ext(Name, Pid, Method, RegNode, FromPidOrNode, ExtraInfo, S0) ->
where(Name) ->
case ets:lookup(global_names, Name) of
- [{_Name, Pid, _Method, _RPid, _Ref}] -> Pid;
+ [{_Name, Pid, _Method, _RPid, _Ref}] ->
+ if node(Pid) == node() ->
+ case is_process_alive(Pid) of
+ true -> Pid;
+ false -> undefined
+ end;
+ true ->
+ Pid
+ end;
[] -> undefined
end.