|
|
@ -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) -> |
|
|
|