瀏覽代碼

优化 调整

master
AICells 4 年之前
父節點
當前提交
d7c48b771a
共有 1 個文件被更改,包括 11 次插入11 次删除
  1. +11
    -11
      src/gen_srv.erl

+ 11
- 11
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.

Loading…
取消
儲存