<div dir="ltr"><div>Hi</div><div>I'm confused by the code snippet of global module. When the 'case clause' matches false, why use spawn_monitor ? Use erlang:monitor could be wrong ? Why ?</div><div><br></div>Besides, what's the <a target="_blank" href="http://www.baidu.com/link?url=xAnXIoWhmKWFBSQUUyQVGU5R3vYAsHfGPJ2rSVSXGaR1kfiKNXdJxod0EhbZg3jq91oZaxYTc8khhaTLWjSW53tqqPMFmMBEtBfjIqW5q9m" style="color:rgb(51,51,51);text-decoration-line:none;font-size:13px;font-family:arial">annotation</a> mean ?<div><br></div><div>Could anybody help me ? Thanks<br><div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"Source Code Pro";font-size:11.3pt"><span style="color:rgb(128,128,128)">%% When/if erlang:monitor() returns before trying to connect to the<br></span><span style="color:rgb(128,128,128)">%% other node this function can be removed.<br></span>do_monitor(<span style="color:rgb(152,118,170)">Pid</span>) -><br>    <span style="color:rgb(204,120,50)">case </span>(node(<span style="color:rgb(152,118,170)">Pid</span>) =:= node()) <span style="color:rgb(204,120,50)">orelse </span>lists:member(node(<span style="color:rgb(152,118,170)">Pid</span>), nodes()) <span style="color:rgb(204,120,50)">of<br></span><span style="color:rgb(204,120,50)">        </span>true -><br>            <span style="color:rgb(128,128,128)">%% Assume the node is still up<br></span><span style="color:rgb(128,128,128)">            </span>{<span style="color:rgb(152,118,170)">Pid</span>, erlang:monitor(process, <span style="color:rgb(152,118,170)">Pid</span>)};<br>        false -><br>            <span style="color:rgb(152,118,170)">F </span>= <span style="color:rgb(204,120,50)">fun</span>() -><br>                <span style="color:rgb(152,118,170)">Ref </span>= erlang:monitor(process, <span style="color:rgb(152,118,170)">Pid</span>),<br>                <span style="color:rgb(204,120,50)">receive<br></span><span style="color:rgb(204,120,50)">                    </span>{'DOWN', <span style="color:rgb(152,118,170)">Ref</span>, process, <span style="color:rgb(152,118,170)">Pid</span>, <span style="color:rgb(152,118,170)">_Info</span>} -><br>                        exit(normal)<br>                <span style="color:rgb(204,120,50)">end<br></span><span style="color:rgb(204,120,50)">                end</span>,<br>            erlang:spawn_monitor(<span style="color:rgb(152,118,170)">F</span>)<br>    <span style="color:rgb(204,120,50)">end.</span></pre></div></div></div>