[erlang-questions] on_load

Zoltan Lajos Kis kiszl@REDACTED
Mon Dec 7 11:41:52 CET 2009


http://www.erlang.org/doc/reference_manual/code_loading.html

"A process that calls any function in a module whose on_load function has
not yet returned will be suspended until the on_load function has
returned."

Isn't there a deadlock with start() waiting for auto_start() to finish and
vice versa?

Regards,
Zoltan.


> I am trying the on_load feature.
>
> I did:
>
> -on_load(auto_start/0).
>
> In a generic server code.
>
> Then I defined auto_start as:
>
> %% called when module is loaded
> auto_start() ->
>     io:format("auto_start\n"),
>     Result = start(),
>     io:format("result = ~p\n", [Result]),
>     true.
>
>
> Where start/0 is the normal:
>
> start() ->
>     gen_server:start({local, ?SERVER}, ?MODULE, [], []).
>
> Question.
>
> Is this supposed to be working ? Why not?
> Currently I get the the "auto_start" output and the the gen_server is
> registered.
> Apart from that it is hanging.
>
>
> /Tony
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>
>




More information about the erlang-questions mailing list