diff options
author | Hans Bolinder <[email protected]> | 2011-11-15 15:18:05 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2011-11-15 15:18:05 +0100 |
commit | 8d911d42d6718029daf92035f24b1389dfdd12e3 (patch) | |
tree | 09076c93d961a5428b688a2e48c896a5074ecf65 /lib/kernel/src/global.erl | |
parent | bf54919396bc4f9e7202be9f8055079fff69098b (diff) | |
parent | c5b73b36525237458cf4138564f17f94ef8635a6 (diff) | |
download | otp-8d911d42d6718029daf92035f24b1389dfdd12e3.tar.gz otp-8d911d42d6718029daf92035f24b1389dfdd12e3.tar.bz2 otp-8d911d42d6718029daf92035f24b1389dfdd12e3.zip |
Merge branch 'hb/stdlib/gen_call_improvement/OTP-9212'
* hb/stdlib/gen_call_improvement/OTP-9212:
Remove the undocumented function global:safe_whereis_name/1
Remove all use of global:safe_whereis_name/1
Fix a minor race in gen_fsm
Diffstat (limited to 'lib/kernel/src/global.erl')
-rw-r--r-- | lib/kernel/src/global.erl | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/kernel/src/global.erl b/lib/kernel/src/global.erl index 7d15f8bf83..fa97614eca 100644 --- a/lib/kernel/src/global.erl +++ b/lib/kernel/src/global.erl @@ -28,7 +28,7 @@ %% External exports -export([start/0, start_link/0, stop/0, sync/0, sync/1, - safe_whereis_name/1, whereis_name/1, register_name/2, + whereis_name/1, register_name/2, register_name/3, register_name_external/2, register_name_external/3, unregister_name_external/1,re_register_name/2, re_register_name/3, unregister_name/1, registered_names/0, send/2, node_disconnected/1, @@ -203,10 +203,6 @@ send(Name, Msg) -> whereis_name(Name) -> where(Name). --spec safe_whereis_name(term()) -> pid() | 'undefined'. -safe_whereis_name(Name) -> - gen_server:call(global_name_server, {whereis, Name}, infinity). - node_disconnected(Node) -> global_name_server ! {nodedown, Node}. @@ -510,8 +506,7 @@ init([]) -> %% delay can sometimes be quite substantial. Global guarantees that %% the name will eventually be removed, but there is no %% synchronization between nodes; the name can be removed from some -%% node(s) long before it is removed from other nodes. Using -%% safe_whereis_name is no cure. +%% node(s) long before it is removed from other nodes. %% %% - Global cannot handle problems with the distribution very well. %% Depending on the value of the kernel variable 'net_ticktime' long @@ -589,10 +584,6 @@ init([]) -> {'reply', term(), state()} | {'stop', 'normal', 'stopped', state()}. -handle_call({whereis, Name}, From, S) -> - do_whereis(Name, From), - {noreply, S}; - handle_call({registrar, Fun}, From, S) -> S#state.the_registrar ! {trans_all_known, Fun, From}, {noreply, S}; @@ -1235,7 +1226,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. |