|
@ -290,7 +290,7 @@ loopEntry(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, |
|
|
%%----------------------------------------------------------------- |
|
|
%%----------------------------------------------------------------- |
|
|
%% Callback functions for system messages handling. |
|
|
%% Callback functions for system messages handling. |
|
|
%%----------------------------------------------------------------- |
|
|
%%----------------------------------------------------------------- |
|
|
system_continue(Parent, Debug, [Name, Module, HibernateAfterTimeout, Timers, CurState, IsHib]) -> |
|
|
|
|
|
|
|
|
system_continue(Parent, Debug, {Name, Module, HibernateAfterTimeout, Timers, CurState, IsHib}) -> |
|
|
case IsHib of |
|
|
case IsHib of |
|
|
true -> |
|
|
true -> |
|
|
proc_lib:hibernate(?MODULE, wakeupFromHib, [Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, IsHib]); |
|
|
proc_lib:hibernate(?MODULE, wakeupFromHib, [Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, IsHib]); |
|
@ -299,10 +299,10 @@ system_continue(Parent, Debug, [Name, Module, HibernateAfterTimeout, Timers, Cur |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|
-spec system_terminate(_, _, _, [_]) -> no_return(). |
|
|
-spec system_terminate(_, _, _, [_]) -> no_return(). |
|
|
system_terminate(Reason, _Parent, Debug, [Name, Module, _HibernateAfterTimeout, Timers, CurState, _IsHib]) -> |
|
|
|
|
|
|
|
|
system_terminate(Reason, _Parent, Debug, {Name, Module, _HibernateAfterTimeout, Timers, CurState, _IsHib}) -> |
|
|
terminate(exit, Reason, ?STACKTRACE(), Name, Module, Debug, Timers, CurState, []). |
|
|
terminate(exit, Reason, ?STACKTRACE(), Name, Module, Debug, Timers, CurState, []). |
|
|
|
|
|
|
|
|
system_code_change([Name, Module, HibernateAfterTimeout, Timers, CurState, IsHib], _Module, OldVsn, Extra) -> |
|
|
|
|
|
|
|
|
system_code_change({Name, Module, HibernateAfterTimeout, Timers, CurState, IsHib}, _Module, OldVsn, Extra) -> |
|
|
case |
|
|
case |
|
|
try Module:code_change(OldVsn, CurState, Extra) |
|
|
try Module:code_change(OldVsn, CurState, Extra) |
|
|
catch |
|
|
catch |
|
@ -310,16 +310,16 @@ system_code_change([Name, Module, HibernateAfterTimeout, Timers, CurState, IsHib |
|
|
_C:_R -> {_R, _R} |
|
|
_C:_R -> {_R, _R} |
|
|
end |
|
|
end |
|
|
of |
|
|
of |
|
|
{ok, NewState} -> {ok, [Name, Module, HibernateAfterTimeout, Timers, NewState, IsHib]}; |
|
|
|
|
|
|
|
|
{ok, NewState} -> {ok, {Name, Module, HibernateAfterTimeout, Timers, NewState, IsHib}}; |
|
|
Error -> Error |
|
|
Error -> Error |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|
system_get_state([_Name, _Module, _HibernateAfterTimeout, _Timers, CurState, _IsHib]) -> |
|
|
|
|
|
|
|
|
system_get_state({_Name, _Module, _HibernateAfterTimeout, _Timers, CurState, _IsHib}) -> |
|
|
{ok, CurState}. |
|
|
{ok, CurState}. |
|
|
|
|
|
|
|
|
system_replace_state(StateFun, [Name, Module, HibernateAfterTimeout, Timers, CurState, IsHib]) -> |
|
|
|
|
|
|
|
|
system_replace_state(StateFun, {Name, Module, HibernateAfterTimeout, Timers, CurState, IsHib}) -> |
|
|
NewState = StateFun(CurState), |
|
|
NewState = StateFun(CurState), |
|
|
{ok, NewState, [Name, Module, HibernateAfterTimeout, Timers, NewState, IsHib]}. |
|
|
|
|
|
|
|
|
{ok, NewState, {Name, Module, HibernateAfterTimeout, Timers, NewState, IsHib}}. |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sys callbacks end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sys callbacks end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% API helpers start %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% API helpers start %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
@ -676,7 +676,7 @@ receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, |
|
|
end; |
|
|
end; |
|
|
{system, PidFrom, Request} -> |
|
|
{system, PidFrom, Request} -> |
|
|
%% 不返回但尾递归调用 system_continue/3 |
|
|
%% 不返回但尾递归调用 system_continue/3 |
|
|
sys:handle_system_msg(Request, PidFrom, Parent, ?MODULE, Debug, [Name, Module, HibernateAfterTimeout, Timers, CurState, IsHib], IsHib); |
|
|
|
|
|
|
|
|
sys:handle_system_msg(Request, PidFrom, Parent, ?MODULE, Debug, {Name, Module, HibernateAfterTimeout, Timers, CurState, IsHib}, IsHib); |
|
|
|
|
|
|
|
|
{'EXIT', Parent, Reason} -> |
|
|
{'EXIT', Parent, Reason} -> |
|
|
terminate(Reason, Reason, ?STACKTRACE(), Name, Module, Debug, Timers, CurState, Msg); |
|
|
terminate(Reason, Reason, ?STACKTRACE(), Name, Module, Debug, Timers, CurState, Msg); |
|
@ -1221,11 +1221,11 @@ mod(_) -> "t". |
|
|
%% Status information |
|
|
%% Status information |
|
|
%%----------------------------------------------------------------- |
|
|
%%----------------------------------------------------------------- |
|
|
format_status(Opt, StatusData) -> |
|
|
format_status(Opt, StatusData) -> |
|
|
[PDict, SysState, Parent, Debug, [Name, State, Module, _Time, _HibernateAfterTimeout]] = StatusData, |
|
|
|
|
|
|
|
|
[PDict, SysState, Parent, Debug, {Name, Module, _HibernateAfterTimeout, _Timers, CurState, _IsHib}] = StatusData, |
|
|
Header = gen:format_status_header("Status for generic server", Name), |
|
|
Header = gen:format_status_header("Status for generic server", Name), |
|
|
Log = sys:get_log(Debug), |
|
|
Log = sys:get_log(Debug), |
|
|
Specific = |
|
|
Specific = |
|
|
case format_status(Opt, Module, PDict, State) of |
|
|
|
|
|
|
|
|
case format_status(Opt, Module, PDict, CurState) of |
|
|
S when is_list(S) -> S; |
|
|
S when is_list(S) -> S; |
|
|
S -> [S] |
|
|
S -> [S] |
|
|
end, |
|
|
end, |
|
|