supervisor, invalid_mfa

Ulf Wiger etxuwig@REDACTED
Mon Dec 17 11:00:58 CET 2001


On 17 Dec 2001, Hal Snyder wrote:

>Is the following an inconsistency?
>
>The docs say Args below can be any Erlang term, but source code
>suggests bad mojo unless Args is a list.
>
>13> supervisor:start_link(my_sup, foo).
>** exited: {start_spec,{invalid_mfa,{my_udps,start_link,foo}}} **

The supervisor behaviour complains about the {my_udps,
start_link, foo}, which must be given as a start specification
for a child inside my_sup:init(foo).

The child specification should include a {M,F,A} tuple that will
be used to start the process (using proc_lib:start_link(M,F,A).
A must thus be a list.

/Uffe

>-- STDLIB Reference Manual / supervisor --
>
>  EXPORTS
>
>  start_link(Module, Args) -> Result
>  start_link(SupName, Module, Args) -> Result
>
>      Types:
>          SupName = {local,Name} | {global,Name}
>           Name = atom()
>          Module = atom()
>==>       Args = term()
>          Result = {ok,Pid} | ignore | {error,Error}
>           Pid = pid()
>           Error = {already_started,Pid}} | shutdown | term()
>
>
>-- $(ERL_TOP)/lib/stdlib/src/supervisor.erl --
>  validFunc({M, F, A}) when atom(M), atom(F), list(A) -> true;
>  validFunc(Func)                                 -> throw({invalid_mfa, Func}).
>
>
>--
>
>Nit: look for "d-tag" in
>  http://www.erlang.org/doc/r8b/lib/kernel-2.7/doc/html/index.html
>

-- 
Ulf Wiger, Senior Specialist,
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson Telecom AB, ATM Multiservice Networks





More information about the erlang-questions mailing list