(spawn_monitor/3)

Sean Hinde sean.hinde@REDACTED
Mon Sep 1 14:53:36 CEST 2003


On Monday, September 1, 2003, at 01:40  pm, Ulf Wiger (ÄL2/EAB) wrote:

>
> I think one reason why this BIF hasn't been added is that
> you will get a DOWN message anyway, since calling
> erlang:monitor/2 on a non-existing process will do just that.

OK, I didn't cotton on to that twist.

>
> What do you gain, apart from one line of code, by making
> it atomic? Granted, in the distributed case, you save some
> network traffic.

Well, you gain consistency with the spawn link case. It feels wrong to 
have the two mechanisms  for monitoring other processes have such 
different meanings and operation. Apart from anything else it would 
probably never have occurred to me (having been brought up on the 
religion that spawn should never be used and that spawn_link is the 
only way to make link atomic) that

Pid = spawn(Fun),
monitor(process, Pid)

is correct, and the only way to achieve the aim, but

Pid = spawn(Fun),
link(Pid)

is utterly verboten.

Sean



More information about the erlang-questions mailing list