<div dir="ltr">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.", <a href="http://www.erlang.org/doc/man/erlang.html#monitor-2">http://www.erlang.org/doc/man/erlang.html#monitor-2</a>). <div>
<br></div><div>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.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sat, Jul 27, 2013 at 1:03 PM, Motiejus Jakštys <span dir="ltr"><<a href="mailto:desired.mta@gmail.com" target="_blank">desired.mta@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Sat, Jul 27, 2013 at 1:05 PM, Michał Ptaszek <<a href="mailto:erlang@ptaszek.net">erlang@ptaszek.net</a>> wrote:<br>
> Hey,<br>
><br>
> What is the reason for not allowing to pass 'monitor' option to processes<br>
> spawned by erlang:spawn_opt/5?<br>
><br>
> The code inside of erlang.erl states:<br>
><br>
> case lists:member(monitor, O) of<br>
> false -> ok;<br>
> true -> erlang:error(badarg, [N, M, F, A, O])<br>
> end,<br>
><br>
> However the documentation does not clarify anything.<br>
> Setting up a monitor on the returned pid right after spawn works fine<br>
> though.<br>
<br>
</div></div>I guess the reason is that there is no way in Erlang to atomically<br>
spawn and monitor the pid on another node. Though it's a bit strange<br>
that [link] works on remote nodes, but [monitor] doesn't. Anyone care<br>
to explain why?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Motiejus Jakštys<br>
</font></span></blockquote></div><br></div>