<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br><div><div>On 16 mar 2014, at 00:21, Tony Rogvall <<a href="mailto:tony@rogvall.se">tony@rogvall.se</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I would like to see (and have been for a long time :):<div><br></div><div>monitor(name, abc) -> reference()</div><div><br></div><div>and then be able get notifications when the name abc is registered and unregistered.</div><div><br></div><div>Then notifications could be something like:</div><div><br></div><div>{'UP',Ref, name, Pid, abc }</div><div>{'UP',Ref, name, Port, abc }</div><div>{'DOWN', Ref, name, Pid, abc}</div><div>{'DOWN', Ref, name, Port, abc}</div><div><br></div></div></blockquote><div><br></div>A comment on my own suggestion:<div><br></div><div>The following (ugly) code in user_sup.erl:</div><div><br></div><div><div>wait_for_user_p(0) -></div><div>    {error, nouser};</div><div>wait_for_user_p(N) -></div><div>    case whereis(user) of</div><div><span class="Apple-tab-span" style="white-space: pre; ">       </span>Pid when is_pid(Pid) -></div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>    link(Pid),</div><div><span class="Apple-tab-span" style="white-space: pre; ">     </span>    {ok, Pid};</div><div><span class="Apple-tab-span" style="white-space: pre; ">     </span>_ -></div><div><span class="Apple-tab-span" style="white-space: pre; ">   </span>    receive after 100 -> ok end,</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>    wait_for_user_p(N-1)</div><div>    end.</div></div><div><br></div><div>Could then be replace with:</div><div><br></div><div>wait_for_user_p(N) -></div><div><span class="Apple-tab-span" style="white-space: pre; ">   </span>Timeout = N*100,</div><div><span class="Apple-tab-span" style="white-space: pre; ">  </span>Ref = erlang:monitor(name, user),</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>recieve</div><div><span class="Apple-tab-span" style="white-space: pre; ">           </span>{'UP', Ref, name, Pid, user} -></div><div><span class="Apple-tab-span" style="white-space: pre; ">                        </span>link(Pid),</div><div><span class="Apple-tab-span" style="white-space: pre; ">                        </span>{ok, Pid}</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>after</div><div><span class="Apple-tab-span" style="white-space: pre; ">             </span>Timeout -></div><div><span class="Apple-tab-span" style="white-space: pre; ">                        </span>{error, nouser}</div><div><span class="Apple-tab-span" style="white-space: pre; ">   </span>end<span class="Apple-tab-span" style="white-space: pre; ">      </span>.</div><div><br></div><div><br></div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>/Tony</div><div><br></div><div><br><div><div>On 14 mar 2014, at 23:50, Loïc Hoguin <<a href="mailto:essen@ninenines.eu">essen@ninenines.eu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hello,<br><br>I want to discuss monitor/2.<br><br>It's been there for a while, and it's always taking 'process' as first argument. Any plans to add anything else? And if nothing is foreseen before the end of times, any plans to add a monitor/1 instead?<br><br>Thanks.<br><br>-- <br>Loïc Hoguin<br><a href="http://ninenines.eu/">http://ninenines.eu</a><br>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 12px; ">"Installing applications can lead to corruption over time. </span><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 12px; ">Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix"</span></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 12px; "><br></span></div></span><br class="Apple-interchange-newline">
</div>
<br></div></div>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></blockquote></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><br></div></span></div></div></body></html>