<div dir="ltr"><div><div>The implication is that as it does not work with spawn_opt/5 which spawns a process on another node then it will also not work for spawn_opt/3 which does the same thing. Whether you give a fun or Mod,Fun,Args is irrelevant here.<br><br></div>Another reason for getting the badarg is the fun. To pass and call funs on other nodes requires exactly the same version of the module in which the fun is defined, in this case erl_eval. An easy way to test this is to just try and spawn the fun on the other node with spawn/2. If that works then this is not the problem.<br><br></div>Robert<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 23 February 2015 at 21:13, Rick Pettit <span dir="ltr"><<a href="mailto:rpettit@vailsys.com" target="_blank">rpettit@vailsys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I might have guessed the same, as I do not use spawn_opt/x much — but looking at the documentation for spawn_opt/3, that third argument is the set of *options* for the spawn opt, and *not* the set of arguments to pass to the fun.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Rick<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On Feb 23, 2015, at 2:07 PM, <a href="mailto:e@bestmx.net">e@bestmx.net</a> wrote:<br>
><br>
> the 0-ary function<br>
> does not unify with a pair of arguments provided.<br>
> i suspect this is the issue.<br>
><br>
><br>
> On 02/23/2015 04:17 PM, Roger Lipscombe wrote:<br>
>> I'm attempting to use spawn_opt/3 with a remote node, like this:<br>
>><br>
>> Fun = fun() -> ok end,<br>
>> {Pid, Ref} = spawn_opt(Node, Fun, [link, monitor]).<br>
>><br>
>> It fails with:<br>
>><br>
>> {badarg,<br>
>> [{erlang,spawn_opt,<br>
>> ['imp_server@roger-pc',erlang,apply,<br>
>> [#Fun<erl_eval.20.80484245>,[]],<br>
>> [link,monitor]],<br>
>> []}<br>
>><br>
>> Now, the documentation at<br>
>> <a href="http://www.erlang.org/doc/man/erlang.html#spawn_opt-5" target="_blank">http://www.erlang.org/doc/man/erlang.html#spawn_opt-5</a> says that the<br>
>> 'monitor' option is not allowed for spawn_opt/5. It says nothing about<br>
>> spawn_opt/3.<br>
>><br>
>> Looking at the error message, it looks like spawn_opt/3 simply calls<br>
>> spawn_opt/5. Does this note about 'monitor' being unsupported need to<br>
>> be in documentation for both functions?<br>
>> _______________________________________________<br>
>> erlang-questions mailing list<br>
>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
>><br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>