[erlang-questions] initializing library applications without processes

Bob Ippolito <>
Sat Apr 3 20:34:59 CEST 2010


You do need some process to own the ets tables, just don't send
messages to it after it's up.

An alternative is something like mochiglobal (in the mochiweb project)
which can be faster than ets for this kind of use case (only important
if you're reading from it often and/or the data is large). It's not
pretty because it's an abuse of the module system and code server...
but until something like it is officially in the VM it's worthy of
consideration ;)

On Sat, Apr 3, 2010 at 11:17 AM, karol skocik <> wrote:
> Hi,
>  sometimes, I just need a library "application" without processes,
> which works with some state in ETS. To function properly,
> they have to make the ETS table and populate it with values
> from config files. When that step is done, there is nothing left to do
> for processes, they would just serve as a useless proxy for
> querying the ETS table, and that's not needed when you can (in some contexts)
> access the table directly.
>
> I like the mechanism of applications and their dependency solving,
> and I would ideally do application:start(my_app_with_ets_initialised)
> but that won't do, since {ok, SupPid} is expected as a result.
>
> But I don't want to start any processes, I just want to ensure that
> application_master:init/4 calls my "start" function,
> and declare application as "running" when 'ok' is returned
> or fail otherwise (unless it's {ok, SupPid} - as it is now).
>
> Currently, when we have library application, application:start(...)
> does not call anything since 'mod' is not specified in .app file.
> Could it be changed, and application behaviour would just call
> start/2 and stop/1 as usual, but start the SupPid optionally when it's supplied?
> Or - alternatively - is there any way how to ensure that some init
> function is done
> fitting nicely with application dependencies as declared in .rel file?
>
> Thanks,
>  Karol
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>


More information about the erlang-questions mailing list