From 89c6eeb30c9cf89261161ffe6f0a8a806733f8b1 Mon Sep 17 00:00:00 2001 From: SisMaker <1713699517@qq.com> Date: Fri, 30 Jun 2023 01:04:26 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gen_apu.erl | 99 +++++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/src/gen_apu.erl b/src/gen_apu.erl index 23d9a78..799b6a8 100644 --- a/src/gen_apu.erl +++ b/src/gen_apu.erl @@ -43,45 +43,45 @@ -define(STACKTRACE(), element(2, erlang:process_info(self(), current_stacktrace))). -type serverName() :: -{'local', atom()} | -{'global', GlobalName :: term()} | -{'via', RegMod :: module(), Name :: term()}. + {'local', atom()} | + {'global', GlobalName :: term()} | + {'via', RegMod :: module(), Name :: term()}. -type serverRef() :: -pid() -| (LocalName :: atom()) -| {Name :: atom(), Node :: atom()} -| {'global', GlobalName :: term()} -| {'via', RegMod :: module(), ViaName :: term()}. + pid() + | (LocalName :: atom()) + | {Name :: atom(), Node :: atom()} + | {'global', GlobalName :: term()} + | {'via', RegMod :: module(), ViaName :: term()}. -type startOpt() :: -daemon | -{'timeout', Time :: timeout()} | -{'spawn_opt', [proc_lib:spawn_option()]} | -enterLoopOpt(). + daemon | + {'timeout', Time :: timeout()} | + {'spawn_opt', [proc_lib:spawn_option()]} | + enterLoopOpt(). -type enterLoopOpt() :: -{'debug', Debugs :: [sys:debug_option()]} | -{'hibernate_after', HibernateAfterTimeout :: timeout()}. + {'debug', Debugs :: [sys:debug_option()]} | + {'hibernate_after', HibernateAfterTimeout :: timeout()}. -type startRet() :: -'ignore' | -{'ok', pid()} | -{'ok', {pid(), reference()}} | -{'error', term()}. + 'ignore' | + {'ok', pid()} | + {'ok', {pid(), reference()}} | + {'error', term()}. -type action() :: -timeout() | -hibernate | -{'doAfter', Args :: term()} | -{'nTimeout', Name :: term(), Time :: timeouts(), TimeoutMsg :: term()} | -{'nTimeout', Name :: term(), Time :: timeouts(), TimeoutMsg :: term(), Options :: ([timeoutOption()])} | -{'uTimeout', Name :: term(), TimeoutMsg :: term()} | -{'cTimeout', Name :: term()}. + timeout() | + hibernate | + {'doAfter', Args :: term()} | + {'nTimeout', Name :: term(), Time :: timeouts(), TimeoutMsg :: term()} | + {'nTimeout', Name :: term(), Time :: timeouts(), TimeoutMsg :: term(), Options :: ([timeoutOption()])} | + {'uTimeout', Name :: term(), TimeoutMsg :: term()} | + {'cTimeout', Name :: term()}. -type actions() :: -action() | -[action(), ...]. + action() | + [action(), ...]. -type timeouts() :: Time :: timeout() | integer(). -type timeoutOption() :: {abs, Abs :: boolean()}. @@ -92,7 +92,7 @@ action() | -type requestId() :: term(). -type replyAction() :: -{'reply', From :: from(), Reply :: term()}. + {'reply', From :: from(), Reply :: term()}. -callback init(Args :: term()) -> {ok, State :: term()} | @@ -103,25 +103,25 @@ action() | %% call 消息的返回 -export_type([handleCallRet/0]). -type handleCallRet() :: -kpS | -{reply, Reply :: term()} | -{reply, Reply :: term(), NewState :: term()} | -{reply, Reply :: term(), NewState :: term(), Actions :: actions()} | -{noreply, NewState :: term()} | -{noreply, NewState :: term(), Actions :: actions()} | -{mayReply, Reply :: term()} | -{mayReply, Reply :: term(), NewState :: term()} | -{mayReply, Reply :: term(), NewState :: term(), Actions :: actions()} | -{stop, Reason :: term(), NewState :: term()} | -{stopReply, Reason :: term(), Reply :: term(), NewState :: term()}. + kpS | + {reply, Reply :: term()} | + {reply, Reply :: term(), NewState :: term()} | + {reply, Reply :: term(), NewState :: term(), Actions :: actions()} | + {noreply, NewState :: term()} | + {noreply, NewState :: term(), Actions :: actions()} | + {mayReply, Reply :: term()} | + {mayReply, Reply :: term(), NewState :: term()} | + {mayReply, Reply :: term(), NewState :: term(), Actions :: actions()} | + {stop, Reason :: term(), NewState :: term()} | + {stopReply, Reason :: term(), Reply :: term(), NewState :: term()}. %% cast 消息的返回 -export_type([handleCastRet/0]). -type handleCastRet() :: -kpS | -{noreply, NewState :: term()} | -{noreply, NewState :: term(), Actions :: actions()} | -{stop, Reason :: term(), NewState :: term()}. + kpS | + {noreply, NewState :: term()} | + {noreply, NewState :: term(), Actions :: actions()} | + {stop, Reason :: term(), NewState :: term()}. -callback handleInfo(Info :: timeout | term(), State :: term()) -> kpS | @@ -155,11 +155,12 @@ kpS | Status :: term(). -optional_callbacks([ -handleAfter/2 -, handleInfo/2 -, terminate/2 -, code_change/3 -, formatStatus/2 + handleAfter/2 + , handleInfo/2 + , handleError/2 + , terminate/2 + , code_change/3 + , formatStatus/2 ]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% start stop API start %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -740,7 +741,7 @@ receiveIng(Parent, Name, Module, GbhOpts, HibernateAfterTimeout, Debug, Timers, matchInfoMsg(Parent, Name, Module, GbhOpts, HibernateAfterTimeout, Debug, Timers, CurState, Msg) end after HibernateAfterTimeout -> - proc_lib:hibernate(?MODULE, wakeupFromHib, [Parent, Name, Module, GbhOpts, HibernateAfterTimeout, Debug, Timers, CurState]) + proc_lib:hibernate(?MODULE, wakeupFromHib, [Parent, Name, Module, GbhOpts, HibernateAfterTimeout, Debug, Timers, CurState, IsHib]) end. matchCallMsg(Parent, Name, Module, GbhOpts, HibernateAfterTimeout, Debug, Timers, CurState, From, Request) ->