supervisor, invalid_mfa

Gunilla (Hugosson) Arendt gunilla@REDACTED
Mon Dec 17 10:20:42 CET 2001


Hi,

'Args' is passed as-is to the callback function init/1 of
the supervisor itself. I.e. in this case my_sup:init(foo) is called
but returns something which is not a correct child specification.

/ Gunilla

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}}} **
> 
> -- 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

-- 
_____Gunilla Arendt______________________________________________
Project Manager, Erlang/OTP
Ericsson Utvecklings AB, UAB/S/P OTP Product Development
gunilla@REDACTED  +46-8-7275730



More information about the erlang-questions mailing list