[erlang-questions] Abusing OTP-8623 for high-priority messages

Tony Rogvall <>
Fri Apr 11 13:48:10 CEST 2014


Now we are getting somewhere !
Good thinking ulf. 

:-)

/Tony

On 11 apr 2014, at 12:52, Ulf Wiger <> wrote:

> 
> On 11 Apr 2014, at 11:04, Tony Rogvall <> wrote:
> 
>> This plan could almost work (theoretically), but would spam ManagerPid for every call to probe for 
>> high prio message. And you surly add latency since you need to wait more than 0
>> millis for a high prio response.
>> 
>> In other words, with my current mindset, the scheme is not really working.
>> But with some new and fresh input this may inspire to even more abuse :-)
> 
> This is how to do it, of course:   ;-)
> 
> PrioRef = make_ref(),
> ManagerPid ! {send_me_prio_request_with_this_ref, PrioRef},
> erlang:hibernate(
>     fun() ->
>         receive
>             {PrioRef, From, Msg} -> handle_call(From, Msg, State)
>         after 0 ->
>             receive
>                 Msg -> gen_server_like_dispatch_msg(Msg)
>         end
>     end).
> 
> Of course, hibernate/1 doesn’t exist, and the compiler would have
> to make the fun ‘inherit’ the receive mark.
> 
> BR,
> Ulf
> 
> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
> http://feuerlabs.com
> 
> 
> 

"Installing applications can lead to corruption over time. 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"



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140411/3aed0ffd/attachment.html>


More information about the erlang-questions mailing list