From d7c48b771aad770d0c1cbf9222d19b05b01548eb Mon Sep 17 00:00:00 2001 From: AICells <1713699517@qq.com> Date: Sat, 11 Jul 2020 19:05:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gen_srv.erl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gen_srv.erl b/src/gen_srv.erl index ce88ba4..15f6da8 100644 --- a/src/gen_srv.erl +++ b/src/gen_srv.erl @@ -105,7 +105,7 @@ -callback handleCall(Request :: term(), State :: term(), From :: {pid(), Tag :: term()}) -> ok | {reply, Reply :: term(), NewState :: term()} | - {reply, Reply :: term(), NewState :: term(), action() | action()} | + {reply, Reply :: term(), NewState :: term(), Actions :: action() | action()} | {noreply, NewState :: term()} | {noreply, NewState :: term(), action() | action()} | {stop, Reason :: term(), Reply :: term(), NewState :: term()} | @@ -206,9 +206,9 @@ init_it(Starter, Parent, ServerRef, Module, Args, Options) -> {ok, State} -> proc_lib:init_ack(Starter, {ok, self()}), receiveIng(Parent, Name, Module, HibernateAfterTimeout, State, Debug, #{}, false); - {ok, State, Action} -> + {ok, State, Actions} -> proc_lib:init_ack(Starter, {ok, self()}), - loopEntry(Parent, Name, Module, HibernateAfterTimeout, State, Debug, #{}, listify(Action)); + loopEntry(Parent, Name, Module, HibernateAfterTimeout, State, Debug, #{}, listify(Actions)); {stop, Reason} -> % 为了保持一致性,我们必须确保在 % %%父进程收到有关失败的通知之前,必须先注销%%注册名称(如果有)。 @@ -252,12 +252,12 @@ enter_loop(Module, State, Opts, ServerName) -> -spec enter_loop(Module :: module(), State :: term(), Opts :: [enterLoopOpt()], Server :: serverName() | pid(), action() | [action()]) -> no_return(). -enter_loop(Module, State, Opts, ServerName, Action) -> +enter_loop(Module, State, Opts, ServerName, Actions) -> Name = gen:get_proc_name(ServerName), Parent = gen:get_parent(), Debug = gen:debug_options(Name, Opts), HibernateAfterTimeout = gen:hibernate_after(Opts), - loopEntry(Parent, Name, Module, HibernateAfterTimeout, State, Debug, #{}, listify(Action)). + loopEntry(Parent, Name, Module, HibernateAfterTimeout, State, Debug, #{}, listify(Actions)). %%% Internal callbacks wakeupFromHib(Parent, Name, Module, HibernateAfterTimeout, CurState, Debug, Timers, IsHib) -> @@ -746,14 +746,14 @@ handleCR(Parent, Name, Module, HibernateAfterTimeout, CurState, Debug, Timers, R reply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), receiveIng(Parent, Name, Module, HibernateAfterTimeout, NewState, NewDebug, Timers, false); - {noreply, NewState, Action} -> - loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewState, Debug, Timers, listify(Action)); + {noreply, NewState, Actions} -> + loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewState, Debug, Timers, listify(Actions)); {stop, Reason, NewState} -> terminate(exit, Reason, ?STACKTRACE(), Name, Module, NewState, Debug, Timers, {return, stop}); - {reply, Reply, NewState, Action} -> + {reply, Reply, NewState, Actions} -> reply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), - loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewState, NewDebug, Timers, listify(Action)); + loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewState, NewDebug, Timers, listify(Actions)); {stop, Reason, Reply, NewState} -> reply(From, Reply), NewDebug = ?SYS_DEBUG(Debug, Name, {out, Reply, From, NewState}), @@ -766,8 +766,8 @@ handleAR(Parent, Name, Module, HibernateAfterTimeout, CurState, Debug, Timers, L loopEntry(Parent, Name, Module, HibernateAfterTimeout, CurState, Debug, Timers, LeftAction); {noreply, NewState} -> loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewState, Debug, Timers, LeftAction); - {noreply, NewState, Action} -> - loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewState, Debug, Timers, listify(Action) ++ LeftAction); + {noreply, NewState, Actions} -> + loopEntry(Parent, Name, Module, HibernateAfterTimeout, NewState, Debug, Timers, listify(Actions) ++ LeftAction); {stop, Reason, NewState} -> terminate(exit, Reason, ?STACKTRACE(), Name, Module, NewState, Debug, Timers, {return, stop_reply}) end.