diff options
author | Kostis Sagonas <[email protected]> | 2010-10-06 19:47:02 +0300 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-10-14 15:30:28 +0200 |
commit | 759f90b8e58ee272e82837329b9dff3ca21ede4c (patch) | |
tree | 397cce00ddd4054d600aa4920c23628e62a3d82b | |
parent | d8f8eeba477fd8872f1136fc507fa299f013cc46 (diff) | |
download | otp-759f90b8e58ee272e82837329b9dff3ca21ede4c.tar.gz otp-759f90b8e58ee272e82837329b9dff3ca21ede4c.tar.bz2 otp-759f90b8e58ee272e82837329b9dff3ca21ede4c.zip |
supervisor: Type and spec related changes
- Export two more types so that they can be used in other modules
- Correct some types and specs
- Add spec for behaviour_info/1
-rw-r--r-- | lib/stdlib/src/supervisor.erl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl index f5d5441184..5bdd1a8672 100644 --- a/lib/stdlib/src/supervisor.erl +++ b/lib/stdlib/src/supervisor.erl @@ -33,7 +33,9 @@ -export([init/1, handle_call/3, handle_info/2, terminate/2, code_change/3]). -export([handle_cast/2]). --export_type([child_spec/0, strategy/0]). +%%-------------------------------------------------------------------------- + +-export_type([child_spec/0, del_err/0, startchild_ret/0, strategy/0]). %%-------------------------------------------------------------------------- @@ -77,6 +79,10 @@ -define(is_simple(State), State#state.strategy =:= simple_one_for_one). +%%-------------------------------------------------------------------------- + +-spec behaviour_info(atom()) -> 'undefined' | [{atom(), arity()}]. + behaviour_info(callbacks) -> [{init,1}]; behaviour_info(_Other) -> @@ -160,11 +166,13 @@ check_childspecs(X) -> {error, {badarg, X}}. %%% %%% --------------------------------------------------- +-type init_sup_name() :: sup_name() | 'self'. + -type stop_rsn() :: 'shutdown' | {'bad_return', {module(),'init', term()}} | {'bad_start_spec', term()} | {'start_spec', term()} | {'supervisor_data', term()}. --spec init({sup_name(), module(), [term()]}) -> +-spec init({init_sup_name(), module(), [term()]}) -> {'ok', state()} | 'ignore' | {'stop', stop_rsn()}. init({SupName, Mod, Args}) -> @@ -184,7 +192,7 @@ init({SupName, Mod, Args}) -> Error -> {stop, {bad_return, {Mod, init, Error}}} end. - + init_children(State, StartSpec) -> SupName = State#state.name, case check_startspec(StartSpec) of |