diff options
author | Siri Hansen <[email protected]> | 2014-03-25 09:46:49 +0100 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2014-03-25 09:47:19 +0100 |
commit | aa2dfd7c30d3ca3318498bcbf4155dad175b6d7e (patch) | |
tree | 3b7d38226fe79cc2b19162313e0eac8a44b697f0 /lib/stdlib/src/gen_server.erl | |
parent | 1eee4ded1b435d3728fc75ad384626c80025bb3b (diff) | |
parent | cbcac6f0d55907dda2e0c385eba44eac2e7923d2 (diff) | |
download | otp-aa2dfd7c30d3ca3318498bcbf4155dad175b6d7e.tar.gz otp-aa2dfd7c30d3ca3318498bcbf4155dad175b6d7e.tar.bz2 otp-aa2dfd7c30d3ca3318498bcbf4155dad175b6d7e.zip |
Merge branch 'vinoski/sys-get-rep-state2'
* vinoski/sys-get-rep-state2:
remove tuple funs from special process documentation
fix sys:get_state/1,2 and sys:replace_state/2,3 when sys suspended
OTP-11817
Diffstat (limited to 'lib/stdlib/src/gen_server.erl')
-rw-r--r-- | lib/stdlib/src/gen_server.erl | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl index 5f14e48b0a..202a931fae 100644 --- a/lib/stdlib/src/gen_server.erl +++ b/lib/stdlib/src/gen_server.erl @@ -98,6 +98,8 @@ -export([system_continue/3, system_terminate/4, system_code_change/4, + system_get_state/1, + system_replace_state/2, format_status/2]). %% Internal exports @@ -372,13 +374,6 @@ wake_hib(Parent, Name, State, Mod, Debug) -> decode_msg(Msg, Parent, Name, State, Mod, Time, Debug, Hib) -> case Msg of - {system, From, get_state} -> - sys:handle_system_msg(get_state, From, Parent, ?MODULE, Debug, - {State, [Name, State, Mod, Time]}, Hib); - {system, From, {replace_state, StateFun}} -> - NState = try StateFun(State) catch _:_ -> State end, - sys:handle_system_msg(replace_state, From, Parent, ?MODULE, Debug, - {NState, [Name, NState, Mod, Time]}, Hib); {system, From, Req} -> sys:handle_system_msg(Req, From, Parent, ?MODULE, Debug, [Name, State, Mod, Time], Hib); @@ -687,6 +682,13 @@ system_code_change([Name, State, Mod, Time], _Module, OldVsn, Extra) -> Else -> Else end. +system_get_state([_Name, State, _Mod, _Time]) -> + {ok, State}. + +system_replace_state(StateFun, [Name, State, Mod, Time]) -> + NState = StateFun(State), + {ok, NState, [Name, NState, Mod, Time]}. + %%----------------------------------------------------------------- %% Format debug messages. Print them as the call-back module sees %% them, not as the real erlang messages. Use trace for that. |