Browse Source

ft: -import代码优化

master
SisMaker 3 years ago
parent
commit
c6503ea894
5 changed files with 75 additions and 67 deletions
  1. +13
    -11
      src/gen_apu.erl
  2. +7
    -7
      src/gen_call.erl
  3. +21
    -20
      src/gen_emm.erl
  4. +21
    -18
      src/gen_ipc.erl
  5. +13
    -11
      src/gen_srv.erl

+ 13
- 11
src/gen_apu.erl View File

@ -5,6 +5,8 @@
-include_lib("kernel/include/logger.hrl").
-import(gen_call, [gcall/3, gcall/4, greply/2]).
-export([
%% API for gen_apu
start/3, start/4, start_link/3, start_link/4
@ -93,7 +95,7 @@ action() |
-type timeoutOption() :: {abs, Abs :: boolean()}.
%% -type timer() :: #{TimeoutName :: atom() => {TimerRef :: reference(), TimeoutMsg :: term()}}.
%% gen_call:call
%% gcall
-type from() :: {To :: pid(), Tag :: term()}.
-type requestId() :: term().
@ -336,7 +338,7 @@ system_replace_state(StateFun, {Name, Module, HibernateAfterTimeout, Timers, Cur
%% is handled here (? Shall we do that here (or rely on timeouts) ?).
-spec call(ServerRef :: serverRef(), Request :: term()) -> Reply :: term().
call(ServerRef, Request) ->
try gen_call:call(ServerRef, '$gen_call', Request) of
try gcall(ServerRef, '$gen_call', Request) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -345,7 +347,7 @@ call(ServerRef, Request) ->
-spec call(ServerRef :: serverRef(), Request :: term(), Timeout :: timeout()) -> Reply :: term().
call(ServerRef, Request, Timeout) ->
try gen_call:call(ServerRef, '$gen_call', Request, Timeout) of
try gcall(ServerRef, '$gen_call', Request, Timeout) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -354,7 +356,7 @@ call(ServerRef, Request, Timeout) ->
-spec clfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok.
clfn(ServerRef, M, F, A) ->
try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}) of
try gcall(ServerRef, '$gen_clfn', {M, F, A}) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -363,7 +365,7 @@ clfn(ServerRef, M, F, A) ->
-spec clfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list(), Timeout :: timeout()) -> ok.
clfn(ServerRef, M, F, A, Timeout) ->
try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}, Timeout) of
try gcall(ServerRef, '$gen_clfn', {M, F, A}, Timeout) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -372,7 +374,7 @@ clfn(ServerRef, M, F, A, Timeout) ->
-spec clfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok.
clfs(ServerRef, M, F, A) ->
try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}) of
try gcall(ServerRef, '$gen_clfs', {M, F, A}) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -381,7 +383,7 @@ clfs(ServerRef, M, F, A) ->
-spec clfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list(), Timeout :: timeout()) -> ok.
clfs(ServerRef, M, F, A, Timeout) ->
try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}, Timeout) of
try gcall(ServerRef, '$gen_clfs', {M, F, A}, Timeout) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -447,8 +449,8 @@ multi_call(Nodes, Name, Request, Timeout) when is_list(Nodes), is_atom(Name), is
do_multi_call([Node], Name, Req, infinity) when Node =:= node() ->
% Special case when multi_call is used with local node only.
% In that case we can leverage the benefit of recv_mark optimisation
% existing in simple gen_call:call.
try gen_call:call(Name, '$gen_call', Req, infinity) of
% existing in simple gcall.
try gcall(Name, '$gen_call', Req, infinity) of
{ok, Res} -> {[{Node, Res}], []}
catch exit:_ ->
{[], [Node]}
@ -547,13 +549,13 @@ reply({reply, {To, Tag}, Reply}) ->
ok
end;
reply(Replies) when is_list(Replies) ->
[ gen_call:reply(From, Reply) || {reply, From, Reply} <- Replies],
[greply(From, Reply) || {reply, From, Reply} <- Replies],
ok.
-compile({inline, [reply/2]}).
-spec reply(From :: from(), Reply :: term()) -> ok.
reply(From, Reply) ->
gen_call:reply(From, Reply).
greply(From, Reply).
%% -----------------------------------------------------------------
%% Send a request to a generic server and return a Key which should be

+ 7
- 7
src/gen_call.erl View File

@ -1,6 +1,6 @@
-module(gen_call).
-export([call/3, call/4, reply/2]).
-export([gcall/3, gcall/4, greply/2]).
-define(default_timeout, 5000).
@ -10,10 +10,10 @@
%% case this node (node()) _is_ distributed and Node =/= node().
-define(get_node(Process), case Process of {_S, N} -> N; _ -> node(Process) end).
call(Process, Label, Request) ->
call(Process, Label, Request, ?default_timeout).
gcall(Process, Label, Request) ->
gcall(Process, Label, Request, ?default_timeout).
call(Process, Label, Request, Timeout) ->
gcall(Process, Label, Request, Timeout) ->
%%-----------------------------------------------------------------
%% Map different specifications of a process to either Pid or
%% {Name,Node}. Execute the given Fun with the process as only
@ -116,9 +116,9 @@ where(Name) ->
%%
%% Send a reply to the client.
%%
reply({_To, [alias | Alias] = Tag}, Reply) when is_reference(Alias) ->
greply({_To, [alias | Alias] = Tag}, Reply) when is_reference(Alias) ->
Alias ! {Tag, Reply}, ok;
reply({_To, [[alias | Alias] | _] = Tag}, Reply) when is_reference(Alias) ->
greply({_To, [[alias | Alias] | _] = Tag}, Reply) when is_reference(Alias) ->
Alias ! {Tag, Reply}, ok;
reply({To, Tag}, Reply) ->
greply({To, Tag}, Reply) ->
try To ! {Tag, Reply}, ok catch _:_ -> ok end.

+ 21
- 20
src/gen_emm.erl View File

@ -6,6 +6,7 @@
-include_lib("kernel/include/logger.hrl").
-import(maps, [iterator/1, next/1]).
-import(gen_call, [gcall/3, gcall/4, greply/2]).
-export([
%% API for gen_emm
@ -291,7 +292,7 @@ check_response(Msg, RequestId) ->
end.
epmRpc(EpmSrv, Cmd) ->
try gen_call:call(EpmSrv, '$epm_call', Cmd, infinity) of
try gcall(EpmSrv, '$epm_call', Cmd, infinity) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -299,7 +300,7 @@ epmRpc(EpmSrv, Cmd) ->
end.
epmRpc(EpmSrv, Cmd, Timeout) ->
try gen_call:call(EpmSrv, '$epm_call', Cmd, Timeout) of
try gcall(EpmSrv, '$epm_call', Cmd, Timeout) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -503,10 +504,10 @@ doSwapSupEpm(EpmHers, EpmId1, Args1, EpmMId, Args2, EpmSup) ->
end.
doNotify(EpmHers, Func, Event, _Form) ->
allNotify(maps:iterator(EpmHers), Func, Event, false, EpmHers, false).
allNotify(iterator(EpmHers), Func, Event, false, EpmHers, false).
allNotify(Iterator, Func, Event, From, TemEpmHers, IsHib) ->
case maps:next(Iterator) of
case next(Iterator) of
{K, _V, NextIterator} ->
case doEpmHandle(TemEpmHers, K, Func, Event, From) of
{NewEpmHers, NewIsHib} ->
@ -640,10 +641,10 @@ report_error(#epmHer{epmId = EpmId, epmM = EpmM}, Reason, State, LastIn) ->
}).
epmStopAll(EpmHers) ->
forStopAll(maps:iterator(EpmHers)).
forStopAll(iterator(EpmHers)).
forStopAll(Iterator) ->
case maps:next(Iterator) of
case next(Iterator) of
{_K, V, NextIterator} ->
epmTerminate(V, stop, stop, shutdown),
case element(#epmHer.epmSup, V) of
@ -658,10 +659,10 @@ forStopAll(Iterator) ->
end.
epmStopOne(ExitEmpSup, EpmHers, Reason) ->
forStopOne(maps:iterator(EpmHers), ExitEmpSup, Reason, EpmHers).
forStopOne(iterator(EpmHers), ExitEmpSup, Reason, EpmHers).
forStopOne(Iterator, ExitEmpSup, Reason, TemEpmHers) ->
case maps:next(Iterator) of
case next(Iterator) of
{K, V, NextIterator} ->
case element(#epmHer.epmSup, V) =:= ExitEmpSup of
true ->
@ -688,12 +689,12 @@ epmTerminate(#epmHer{epmM = EpmM, epmS = State} = EpmHer, Args, LastIn, Reason)
-compile({inline, [reply/2]}).
-spec reply(From :: from(), Reply :: term()) -> ok.
reply(From, Reply) ->
gen_call:reply(From, Reply).
greply(From, Reply).
try_reply(false, _Msg) ->
ignore;
try_reply(From, Reply) ->
gen_call:reply(From, Reply).
greply(From, Reply).
terminate_server(Reason, _Parent, _ServerName, EpmHers) ->
epmStopAll(EpmHers),
@ -714,11 +715,11 @@ system_terminate(Reason, Parent, _Debug, {ServerName, _HibernateAfterTimeout, Ep
%% which module should be changed.
%%-----------------------------------------------------------------
system_code_change({ServerName, HibernateAfterTimeout, EpmHers, IsHib}, Module, OldVsn, Extra) ->
NewEpmHers = forCodeChange(maps:iterator(EpmHers), Module, OldVsn, Extra, EpmHers),
NewEpmHers = forCodeChange(iterator(EpmHers), Module, OldVsn, Extra, EpmHers),
{ok, {ServerName, HibernateAfterTimeout, NewEpmHers, IsHib}}.
forCodeChange(Iterator, CModule, OldVsn, Extra, TemEpmHers) ->
case maps:next(Iterator) of
case next(Iterator) of
{K, #epmHer{epmM = Module, epmS = EpmS} = V, NextIterator} when Module =:= CModule ->
{ok, NewEpmS} = Module:code_change(OldVsn, EpmS, Extra),
forCodeChange(NextIterator, CModule, OldVsn, Extra, TemEpmHers#{K := V#epmHer{epmS = NewEpmS}});
@ -729,10 +730,10 @@ forCodeChange(Iterator, CModule, OldVsn, Extra, TemEpmHers) ->
end.
system_get_state({_ServerName, _HibernateAfterTimeout, EpmHers, _Hib}) ->
{ok, forGetState(maps:iterator(EpmHers), [])}.
{ok, forGetState(iterator(EpmHers), [])}.
forGetState(Iterator, Acc) ->
case maps:next(Iterator) of
case next(Iterator) of
{_K, #epmHer{epmId = EpmId, epmM = Module, epmS = EpmS}, NextIterator} ->
forGetState(NextIterator, [{Module, EpmId, EpmS} | Acc]);
_ ->
@ -740,11 +741,11 @@ forGetState(Iterator, Acc) ->
end.
system_replace_state(StateFun, {ServerName, HibernateAfterTimeout, EpmHers, IsHib}) ->
{NewEpmHers, NStates} = forReplaceState(maps:iterator(EpmHers), StateFun, EpmHers, []),
{NewEpmHers, NStates} = forReplaceState(iterator(EpmHers), StateFun, EpmHers, []),
{ok, NStates, {ServerName, HibernateAfterTimeout, NewEpmHers, IsHib}}.
forReplaceState(Iterator, StateFun, TemEpmHers, NStates) ->
case maps:next(Iterator) of
case next(Iterator) of
{K, #epmHer{epmId = EpmId, epmM = Module, epmS = EpmS} = V, NextIterator} ->
NState = {_, _, NewEpmS} = StateFun({Module, EpmId, EpmS}),
forReplaceState(NextIterator, StateFun, TemEpmHers#{K := V#epmHer{epmS = NewEpmS}}, [NState | NStates]);
@ -929,10 +930,10 @@ mod(_) -> "t".
%% Message from the release_handler.
%% The list of modules got to be a set, i.e. no duplicate elements!
get_modules(EpmHers) ->
allMods(maps:iterator(EpmHers), []).
allMods(iterator(EpmHers), []).
allMods(Iterator, Acc) ->
case maps:next(Iterator) of
case next(Iterator) of
{_K, V, NextIterator} ->
allMods(NextIterator, [element(#epmHer.epmM, V) | Acc]);
_ ->
@ -945,11 +946,11 @@ allMods(Iterator, Acc) ->
format_status(Opt, StatusData) ->
[PDict, SysState, Parent, _Debug, {ServerName, _HibernateAfterTimeout, EpmHers, _IsHib}] = StatusData,
Header = gen:format_status_header("Status for gen_emm handler", ServerName),
FmtMSL = allStateStatus(maps:iterator(EpmHers), Opt, PDict, []),
FmtMSL = allStateStatus(iterator(EpmHers), Opt, PDict, []),
[{header, Header}, {data, [{"Status", SysState}, {"Parent", Parent}]}, {items, {"Installed handlers", FmtMSL}}].
allStateStatus(Iterator, Opt, PDict, EpmHers) ->
case maps:next(Iterator) of
case next(Iterator) of
{_K, #epmHer{epmM = Module, epmS = EpmS} = V, NextIterator} ->
NewEpmS = format_status(Opt, Module, PDict, EpmS),
allStateStatus(NextIterator, Opt, PDict, [V#epmHer{epmS = NewEpmS} | EpmHers]);

+ 21
- 18
src/gen_ipc.erl View File

@ -5,6 +5,9 @@
-include_lib("kernel/include/logger.hrl").
-import(maps, [iterator/1, next/1]).
-import(gen_call, [gcall/3, gcall/4, greply/2]).
-export([
%% API for gen_server or gen_statem behaviour
start/3, start/4, start_link/3, start_link/4
@ -81,7 +84,7 @@
%%%==========================================================================
%%% Interface functions.
%%%==========================================================================
%% gen_call:call
%% gcall
-type from() :: {To :: pid(), Tag :: term()}.
-type requestId() :: term().
@ -504,7 +507,7 @@ format_status(Opt, [PDict, SysStatus, Parent, Debug, {Parent, Name, Module, Hibe
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% API helpers start %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-spec call(ServerRef :: serverRef(), Request :: term()) -> Reply :: term().
call(ServerRef, Request) ->
try gen_call:call(ServerRef, '$gen_call', Request) of
try gcall(ServerRef, '$gen_call', Request) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -513,7 +516,7 @@ call(ServerRef, Request) ->
-spec call(ServerRef :: serverRef(), Request :: term(), Timeout :: timeout()) -> Reply :: term().
call(ServerRef, Request, Timeout) ->
try gen_call:call(ServerRef, '$gen_call', Request, Timeout) of
try gcall(ServerRef, '$gen_call', Request, Timeout) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -534,8 +537,8 @@ multi_call(Nodes, Name, Request, Timeout) when is_list(Nodes), is_atom(Name), is
do_multi_call([Node], Name, Req, infinity) when Node =:= node() ->
% Special case when multi_call is used with local node only.
% In that case we can leverage the benefit of recv_mark optimisation
% existing in simple gen_call:call.
try gen_call:call(Name, '$gen_call', Req, infinity) of
% existing in simple gcall.
try gcall(Name, '$gen_call', Req, infinity) of
{ok, Res} -> {[{Node, Res}], []}
catch exit:_ ->
{[], [Node]}
@ -782,18 +785,18 @@ reply({reply, {To, Tag}, Reply}) ->
ok
end;
reply(Replies) when is_list(Replies) ->
[ gen_call:reply(From, Reply) || {reply, From, Reply} <- Replies],
[greply(From, Reply) || {reply, From, Reply} <- Replies],
ok.
-compile({inline, [reply/2]}).
-spec reply(From :: from(), Reply :: term()) -> ok.
reply(From, Reply) ->
gen_call:reply(From, Reply).
greply(From, Reply).
try_reply(false, _Msg) ->
ignore;
try_reply(From, Reply) ->
gen_call:reply(From, Reply).
greply(From, Reply).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% API helpers end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% gen_event start %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -820,7 +823,7 @@ info_notify(EpmSrv, Event) ->
epmRequest(EpmSrv, {'$epm_info', '$infoNotify', Event}).
epmRpc(EpmSrv, Cmd) ->
try gen_call:call(EpmSrv, '$epm_call', Cmd, infinity) of
try gcall(EpmSrv, '$epm_call', Cmd, infinity) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -828,7 +831,7 @@ epmRpc(EpmSrv, Cmd) ->
end.
epmRpc(EpmSrv, Cmd, Timeout) ->
try gen_call:call(EpmSrv, '$epm_call', Cmd, Timeout) of
try gcall(EpmSrv, '$epm_call', Cmd, Timeout) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -951,10 +954,10 @@ doSwapSupEpm(EpmHers, EpmId1, Args1, EpmMId, Args2, EpmSup) ->
end.
doNotify(EpmHers, Func, Event, _Form) ->
allNotify(maps:iterator(EpmHers), Func, Event, false, EpmHers, false).
allNotify(iterator(EpmHers), Func, Event, false, EpmHers, false).
allNotify(Iterator, Func, Event, From, TemEpmHers, IsHib) ->
case maps:next(Iterator) of
case next(Iterator) of
{K, _V, NextIterator} ->
{NewEpmHers, NewIsHib} = doEpmHandle(TemEpmHers, K, Func, Event, From),
allNotify(NextIterator, Func, Event, From, NewEpmHers, IsHib orelse NewIsHib);
@ -1066,10 +1069,10 @@ epm_log(#{label := {gen_ipc, no_handle_info}, module := Module, message := Msg})
"** Unhandled message: ~tp~n", [Module, Msg]}.
epmStopAll(EpmHers) ->
allStop(maps:iterator(EpmHers)).
allStop(iterator(EpmHers)).
allStop(Iterator) ->
case maps:next(Iterator) of
case next(Iterator) of
{_K, V, NextIterator} ->
epmTerminate(V, stop, 'receive', shutdown),
case element(#epmHer.epmSup, V) of
@ -1084,10 +1087,10 @@ allStop(Iterator) ->
end.
epmStopOne(ExitEmpSup, EpmHers) ->
forStopOne(maps:iterator(EpmHers), ExitEmpSup, EpmHers).
forStopOne(iterator(EpmHers), ExitEmpSup, EpmHers).
forStopOne(Iterator, ExitEmpSup, TemEpmHers) ->
case maps:next(Iterator) of
case next(Iterator) of
{K, V, NextIterator} ->
case element(#epmHer.epmSup, V) =:= ExitEmpSup of
true ->
@ -1978,10 +1981,10 @@ cancelTimer(TimeoutType, TimerRef, Timers) ->
%% Return a list of all pending timeouts
listTimeouts(Timers) ->
{maps:size(Timers), allTimer(maps:iterator(Timers), [])}.
{maps:size(Timers), allTimer(iterator(Timers), [])}.
allTimer(Iterator, Acc) ->
case maps:next(Iterator) of
case next(Iterator) of
{TimeoutType, {_TimerRef, TimeoutMsg}, NextIterator} ->
allTimer(NextIterator, [{TimeoutType, TimeoutMsg} | Acc]);
none ->

+ 13
- 11
src/gen_srv.erl View File

@ -5,6 +5,8 @@
-include_lib("kernel/include/logger.hrl").
-import(gen_call, [gcall/3, gcall/4, greply/2]).
-export([
%% API for gen_srv
start/3, start/4, start_link/3, start_link/4
@ -93,7 +95,7 @@
-type timeoutOption() :: {abs, Abs :: boolean()}.
%% -type timer() :: #{TimeoutName :: atom() => {TimerRef :: reference(), TimeoutMsg :: term()}}.
%% gen_call:call
%% gcall
-type from() :: {To :: pid(), Tag :: term()}.
-type requestId() :: term().
@ -332,7 +334,7 @@ system_replace_state(StateFun, {Name, Module, HibernateAfterTimeout, Timers, Cur
%% is handled here (? Shall we do that here (or rely on timeouts) ?).
-spec call(ServerRef :: serverRef(), Request :: term()) -> Reply :: term().
call(ServerRef, Request) ->
try gen_call:call(ServerRef, '$gen_call', Request) of
try gcall(ServerRef, '$gen_call', Request) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -341,7 +343,7 @@ call(ServerRef, Request) ->
-spec call(ServerRef :: serverRef(), Request :: term(), Timeout :: timeout()) -> Reply :: term().
call(ServerRef, Request, Timeout) ->
try gen_call:call(ServerRef, '$gen_call', Request, Timeout) of
try gcall(ServerRef, '$gen_call', Request, Timeout) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -350,7 +352,7 @@ call(ServerRef, Request, Timeout) ->
-spec clfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok.
clfn(ServerRef, M, F, A) ->
try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}) of
try gcall(ServerRef, '$gen_clfn', {M, F, A}) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -359,7 +361,7 @@ clfn(ServerRef, M, F, A) ->
-spec clfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list(), Timeout :: timeout()) -> ok.
clfn(ServerRef, M, F, A, Timeout) ->
try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}, Timeout) of
try gcall(ServerRef, '$gen_clfn', {M, F, A}, Timeout) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -368,7 +370,7 @@ clfn(ServerRef, M, F, A, Timeout) ->
-spec clfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok.
clfs(ServerRef, M, F, A) ->
try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}) of
try gcall(ServerRef, '$gen_clfs', {M, F, A}) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -377,7 +379,7 @@ clfs(ServerRef, M, F, A) ->
-spec clfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list(), Timeout :: timeout()) -> ok.
clfs(ServerRef, M, F, A, Timeout) ->
try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}, Timeout) of
try gcall(ServerRef, '$gen_clfs', {M, F, A}, Timeout) of
{ok, Reply} ->
Reply
catch Class:Reason ->
@ -443,8 +445,8 @@ multi_call(Nodes, Name, Request, Timeout) when is_list(Nodes), is_atom(Name), is
do_multi_call([Node], Name, Req, infinity) when Node =:= node() ->
% Special case when multi_call is used with local node only.
% In that case we can leverage the benefit of recv_mark optimisation
% existing in simple gen_call:call.
try gen_call:call(Name, '$gen_call', Req, infinity) of
% existing in simple gcall.
try gcall(Name, '$gen_call', Req, infinity) of
{ok, Res} -> {[{Node, Res}], []}
catch exit:_ ->
{[], [Node]}
@ -543,13 +545,13 @@ reply({reply, {To, Tag}, Reply}) ->
ok
end;
reply(Replies) when is_list(Replies) ->
[ gen_call:reply(From, Reply) || {reply, From, Reply} <- Replies],
[greply(From, Reply) || {reply, From, Reply} <- Replies],
ok.
-compile({inline, [reply/2]}).
-spec reply(From :: from(), Reply :: term()) -> ok.
reply(From, Reply) ->
gen_call:reply(From, Reply).
greply(From, Reply).
%% -----------------------------------------------------------------
%% Send a request to a generic server and return a Key which should be

Loading…
Cancel
Save