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

Arie van Wingerden xapwing@REDACTED
Wed Apr 6 22:07:54 CEST 2011


thx Raimo!
   Arie

2011/4/6 Raimo Niskanen <raimo+erlang-questions@REDACTED>

> On Wed, Apr 06, 2011 at 02:44:39PM +0200, Ulf Wiger wrote:
> >
> > Any time you call a function, the input arguments are evaluated before
> the function is executed, so the spawn should *always* execute in this case.
> >
> > This is characteristic of a language with eager (as opposed to lazy)
> evaluation.
> >
> > BR,
> > Ulf W
> >
> > On 6 Apr 2011, at 14:40, Arie van Wingerden wrote:
> >
> > > Hi,
> > >
> > > 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?
>
> Pid = spawn_link(fun () -> register(id, self()), my:loop() end),
>
> > >
> > > Regards,
> > >    Arie
> > > _______________________________________________
> > > erlang-questions mailing list
> > > erlang-questions@REDACTED
> > > http://erlang.org/mailman/listinfo/erlang-questions
> >
> > Ulf Wiger, CTO, Erlang Solutions, Ltd.
> > http://erlang-solutions.com
> >
> >
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110406/d4e6b58e/attachment.htm>


More information about the erlang-questions mailing list