[erlang-questions] Monitor option in spawn_opt/5

Michał Ptaszek erlang@REDACTED
Mon Jul 29 13:54:54 CEST 2013


I'm not sure if spawn and monitor have to be atomic though. If we set up a
monitor on non-existing/exiting process 'DOWN' message is going to be
delivered to the caller anyway ("A 'DOWN' message will be sent to the
monitoring process if Item dies, if Item does not exist, or if the
connection is lost to the node which Item resides on.",
http://www.erlang.org/doc/man/erlang.html#monitor-2).

It's not a big deal for me to spin up a monitor on my own, however it would
be good to know if I miss something or should code/documentation be fixed.


On Sat, Jul 27, 2013 at 1:03 PM, Motiejus Jakštys <desired.mta@REDACTED>wrote:

> On Sat, Jul 27, 2013 at 1:05 PM, Michał Ptaszek <erlang@REDACTED>
> wrote:
> > Hey,
> >
> > What is the reason for not allowing to pass 'monitor' option to processes
> > spawned by erlang:spawn_opt/5?
> >
> > The code inside of erlang.erl states:
> >
> >     case lists:member(monitor, O) of
> > false -> ok;
> > true -> erlang:error(badarg, [N, M, F, A, O])
> >     end,
> >
> > However the documentation does not clarify anything.
> > Setting up a monitor on the returned pid right after spawn works fine
> > though.
>
> I guess the reason is that there is no way in Erlang to atomically
> spawn and monitor the pid on another node. Though it's a bit strange
> that [link] works on remote nodes, but [monitor] doesn't. Anyone care
> to explain why?
>
> --
> Motiejus Jakštys
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130729/7c09c9c9/attachment.htm>


More information about the erlang-questions mailing list