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

Raimo Niskanen raimo+erlang-questions@REDACTED
Wed Apr 6 18:07:28 CEST 2011


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



More information about the erlang-questions mailing list