diff options
author | Siri Hansen <[email protected]> | 2016-02-03 12:10:06 +0100 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2016-02-03 12:14:10 +0100 |
commit | 4422cb32637a341eac2dc03172e4aa859be67f34 (patch) | |
tree | 7bc906be4116fc755aa11a45730297eb365fe31a /lib/stdlib/src/supervisor.erl | |
parent | b8c6a1196f0be5a2e98429797b43c24784bcafca (diff) | |
download | otp-4422cb32637a341eac2dc03172e4aa859be67f34.tar.gz otp-4422cb32637a341eac2dc03172e4aa859be67f34.tar.bz2 otp-4422cb32637a341eac2dc03172e4aa859be67f34.zip |
Add supervisor:get_callback_module/1
This function is used by release_handler during upgrade. This was
earlier implemented in the release_handler, but it required a copy og
the definition of the supervisor's internal state, which caused
problems when this state was updated.
Diffstat (limited to 'lib/stdlib/src/supervisor.erl')
-rw-r--r-- | lib/stdlib/src/supervisor.erl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl index 92a0c29011..6a5005b4b6 100644 --- a/lib/stdlib/src/supervisor.erl +++ b/lib/stdlib/src/supervisor.erl @@ -33,6 +33,9 @@ terminate/2, code_change/3]). -export([try_again_restart/2]). +%% For release_handler only +-export([get_callback_module/1]). + %%-------------------------------------------------------------------------- -export_type([sup_flags/0, child_spec/0, startchild_ret/0, strategy/0]). @@ -250,6 +253,17 @@ try_again_restart(Supervisor, Child) -> cast(Supervisor, Req) -> gen_server:cast(Supervisor, Req). +%%%----------------------------------------------------------------- +%%% Called by release_handler during upgrade +-spec get_callback_module(Pid) -> Module when + Pid :: pid(), + Module :: atom(). +get_callback_module(Pid) -> + {status, _Pid, {module, _Mod}, + [_PDict, _SysState, _Parent, _Dbg, Misc]} = sys:get_status(Pid), + [_Header, _Data, {data, [{"State", State}]}] = Misc, + State#state.module. + %%% --------------------------------------------------- %%% %%% Initialize the supervisor. |