aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/src/mnesia_sup.erl
diff options
context:
space:
mode:
authorRichard Carlsson <[email protected]>2016-10-29 16:23:09 +0200
committerRichard Carlsson <[email protected]>2016-10-29 16:23:09 +0200
commitcd8438832471e7444eec7b78cd1aaee6779cc28a (patch)
tree527d879440a9b8bb94e611a40020826cb39e5b45 /lib/mnesia/src/mnesia_sup.erl
parentc49194c9239c0dcad17b902b6638edf53bb69c6c (diff)
downloadotp-cd8438832471e7444eec7b78cd1aaee6779cc28a.tar.gz
otp-cd8438832471e7444eec7b78cd1aaee6779cc28a.tar.bz2
otp-cd8438832471e7444eec7b78cd1aaee6779cc28a.zip
Make a separate application module for Mnesia
To separate concerns and reduce confusion, avoid implementing two behaviours in a single module. Make a single start_link() helper in mnesia_sup and remove the unused mnesia_sup:start() utility function.
Diffstat (limited to 'lib/mnesia/src/mnesia_sup.erl')
-rw-r--r--lib/mnesia/src/mnesia_sup.erl33
1 files changed, 7 insertions, 26 deletions
diff --git a/lib/mnesia/src/mnesia_sup.erl b/lib/mnesia/src/mnesia_sup.erl
index 4aece81308..3e5792900b 100644
--- a/lib/mnesia/src/mnesia_sup.erl
+++ b/lib/mnesia/src/mnesia_sup.erl
@@ -23,39 +23,21 @@
-module(mnesia_sup).
--behaviour(application).
-behaviour(supervisor).
--export([start/0, start/2, init/1, stop/1, start_event/0, kill/0]).
+-export([start_link/1, init/1, start_event/0, kill/0]).
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% application and suprvisor callback functions
-
-start(normal, Args) ->
- SupName = {local,?MODULE},
- case supervisor:start_link(SupName, ?MODULE, [Args]) of
- {ok, Pid} ->
- {ok, Pid, {normal, Args}};
- Error ->
- Error
- end;
-start(_, _) ->
- {error, badarg}.
-
-start() ->
- SupName = {local,?MODULE},
- supervisor:start_link(SupName, ?MODULE, []).
+start_link(Args) ->
+ supervisor:start_link({local,?MODULE}, ?MODULE, [Args]).
-stop(_StartArgs) ->
- ok.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% supervisor callback functions
-init([]) -> % Supervisor
- init();
-init([[]]) -> % Application
+init([[]]) ->
init();
init(BadArg) ->
{error, {badarg, BadArg}}.
-
+
init() ->
Flags = {one_for_all, 0, 3600}, % Should be rest_for_one policy
@@ -124,4 +106,3 @@ ensure_dead(Name) ->
timer:sleep(10),
ensure_dead(Name)
end.
-