diff options
author | Björn Gustavsson <[email protected]> | 2012-09-19 12:09:22 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-09-19 12:09:22 +0200 |
commit | c24f87e19cc01437c3c7b84e9c3fbeceb8c3b736 (patch) | |
tree | 46763502c6545056dddceff59de1c1fbace09384 /lib/kernel/src | |
parent | b58ce62a0cf296ca8cd8cd77b053bc70ecf28758 (diff) | |
parent | 9d1203d2ad5904529754e5e889fe37f8d229ad4c (diff) | |
download | otp-c24f87e19cc01437c3c7b84e9c3fbeceb8c3b736.tar.gz otp-c24f87e19cc01437c3c7b84e9c3fbeceb8c3b736.tar.bz2 otp-c24f87e19cc01437c3c7b84e9c3fbeceb8c3b736.zip |
Merge branch 'bjorn/kernel/global-resolve-function-fix/OTP-10419'
* bjorn/kernel/global-resolve-function-fix/OTP-10419:
global: Allow "tuple funs" as resolve functions
Diffstat (limited to 'lib/kernel/src')
-rw-r--r-- | lib/kernel/src/global.erl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/kernel/src/global.erl b/lib/kernel/src/global.erl index 36cb713ee1..b24a9d5eac 100644 --- a/lib/kernel/src/global.erl +++ b/lib/kernel/src/global.erl @@ -232,7 +232,8 @@ register_name(Name, Pid) when is_pid(Pid) -> Name :: term(), Pid :: pid(), Resolve :: method(). -register_name(Name, Pid, Method) when is_pid(Pid) -> +register_name(Name, Pid, Method0) when is_pid(Pid) -> + Method = allow_tuple_fun(Method0), Fun = fun(Nodes) -> case (where(Name) =:= undefined) andalso check_dupname(Name, Pid) of true -> @@ -290,7 +291,8 @@ re_register_name(Name, Pid) when is_pid(Pid) -> Name :: term(), Pid :: pid(), Resolve :: method(). -re_register_name(Name, Pid, Method) when is_pid(Pid) -> +re_register_name(Name, Pid, Method0) when is_pid(Pid) -> + Method = allow_tuple_fun(Method0), Fun = fun(Nodes) -> gen_server:multi_call(Nodes, global_name_server, @@ -2218,3 +2220,9 @@ intersection(_, []) -> []; intersection(L1, L2) -> L1 -- (L1 -- L2). + +%% Support legacy tuple funs as resolve functions. +allow_tuple_fun({M, F}) when is_atom(M), is_atom(F) -> + fun M:F/3; +allow_tuple_fun(Fun) when is_function(Fun, 3) -> + Fun. |