<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 11 Apr 2014, at 11:04, Tony Rogvall <<a href="mailto:tony@rogvall.se">tony@rogvall.se</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">This plan could almost work (theoretically), but would spam ManagerPid for every call to probe for </div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">high prio message. And you surly add latency since you need to wait more than 0</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">millis for a high prio response.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">In other words, with my current mindset, the scheme is not really working.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">But with some new and fresh input this may inspire to even more abuse :-)</div></blockquote><br></div><div>This is how to do it, of course:   ;-)</div><div><br></div><div><div>PrioRef = make_ref(),</div><div>ManagerPid ! {send_me_prio_request_with_this_ref, PrioRef},</div><div>erlang:hibernate(</div><div>    fun() -></div><div>        receive</div><div><div>            {PrioRef, From, Msg} -> handle_call(From, Msg, State)</div><div>        after 0 -></div><div>            receive</div><div>                Msg -> gen_server_like_dispatch_msg(Msg)</div><div>        end</div><div>    end).</div></div><div><br></div><div>Of course, hibernate/1 doesn’t exist, and the compiler would have</div><div>to make the fun ‘inherit’ the receive mark.</div><div><br></div><div>BR,</div><div>Ulf</div></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;"><div><div>Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.</div><div><a href="http://feuerlabs.com">http://feuerlabs.com</a></div></div><div><br></div></span><br class="Apple-interchange-newline">

</div>
<br></body></html>