[erlang-questions] Question about priority receive and "large" mailboxes

Jim McCoy <>
Thu Aug 2 21:02:44 CEST 2007


In Programming Erlang an example of using a receive with an "after 0"
timeout to implement a priority receive is provided.  A small warning
is given after the example suggestion that one should avoid using this
for "large" mailboxes.  Is "large" a measure of the number of waiting
messages or the total size of all waiting messages?

Is it a bad idea to use this sort of a priority queue for the incoming
messages if I have a mailbox which will only have a few messages in it
at any given time if it is possible that some of these messages might
be very large?  Each message would be a {type, payload} tuple with the
high-priority messages having a very small payload and the low
priority messages having a very large payload.

Regards,

Jim



More information about the erlang-questions mailing list