[erlang-questions] Re: Question about register/2

Vlad Dumitrescu vladdu55@REDACTED
Wed Apr 6 14:53:59 CEST 2011


Hi,

On Wed, Apr 6, 2011 at 14:40, Arie van Wingerden <xapwing@REDACTED> wrote:

> when I issue register(id, spawn aFun) and id already is associated with
> some process, the function fails.
>
> What disturbs me is that the check of id already being taken for another
> pid, might take place *after* the spawn has been executed.
> Hence a "ghost" process is running.
>
> Is this the way it works? And how is this mostly solved?
>

The solution is to let the spawned process register itself right after
starting. If that fails, just let it die and theres is no ghost-process
anymore.

regards,
Vlad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110406/bb8880fa/attachment.htm>


More information about the erlang-questions mailing list