[erlang-questions] Predefined Registered Processes

8 views
Skip to first unread message

Maruthavanan Subbarayan

unread,
Jun 4, 2012, 12:58:11 AM6/4/12
to erlang-q...@erlang.org
Hi,

I was wondering do we have any predefined list of registered processes listed down?

Because I did a small mistake by chance.

I registered my database supervisor as odbc_sup, after which erlang did not allow application:start(odbc) throwing the below exception

{error,{{already_started,<0.62.0>},
        {odbc_app,start,[normal,[]]}}}
=INFO REPORT==== 4-Jun-2012::10:23:24 ===
    application: odbc
    exited: {{already_started,<0.62.0>},{odbc_app,start,[normal,[]]}}
    type: temporary

Later I found that odbc library of erlang tries to register its process but failing as my database supervisor has already started with same name. after renaming it worked.

So thought if we have such a place where it is listed down, it would be helpful to some like me; may be the list is big but still wanted to check it up.

Thanks,
Marutha

Michael Turner

unread,
Jun 4, 2012, 2:12:46 AM6/4/12
to Maruthavanan Subbarayan, erlang-q...@erlang.org
It's hard to predict what *could* get registered after start-up - are
there guarantees anywhere? But I've found a way to get by, for now.

Since I'm using the process registry in a kind of hacky way at the
moment, and need to know what I *haven't* registered myself, I
initially get the list of what's currently registered using a call to
registered/0

http://www.erlang.org/doc/reference_manual/processes.html#id82208

shortly after starting the Erlang shell. I'm not sure how a standalone
app would figure out when a call to registered/0 would return the
complete list -- whatever "complete" means in this case. Does anyone
know? It seems like you'd have to get complete initialization of
everything you use that might register a process, and maybe the only
way to be sure is to keep checking against a list of names to see if
the process has been registered yet. And if you already have that list
....

I also qualify the process names I use, prefixing each with a period
('.'), to help avoid any future clashes. This means putting single
quotes around each process-name atom, but I can live with that. It's
dangerous in the long run, I hope to move to a more sensible scheme
soon, but it's fine for now.

-michael turner
> _______________________________________________
> erlang-questions mailing list
> erlang-q...@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions
>
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Motiejus Jakštys

unread,
Jun 4, 2012, 3:43:19 AM6/4/12
to Maruthavanan Subbarayan, erlang-q...@erlang.org
On Mon, Jun 4, 2012 at 6:58 AM, Maruthavanan Subbarayan
<marutha...@hotmail.com> wrote:
> Hi,
>

> Because I did a small mistake by chance.

Does not really answer your question, but if the program gets bigger
and more complex, and more advanced process register is required, I
suggest having a look at pg2 or gproc. I use former and it's pretty
cool. Also, *no* collisions. You can register a tuple {myodbc,
supervisor} and you're safe.

--
Motiejus Jakštys

Reply all
Reply to author
Forward
0 new messages