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

Bengt Kleberg bengt.kleberg@REDACTED
Fri Aug 3 08:56:21 CEST 2007


On 2007-08-02 21:02, Jim McCoy wrote:
> 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?

it is the total size of all waiting messages.

the idea is that if you have a steady input of high priority messages 
you might never have the time to handle/remove the low priority 
messages. thus making the mailbox grow without bounds. sooner or later 
that will exhaust your memory.


bengt
-- 
Those were the days...
    EPO guidelines 1978: "If the contribution to the known art resides
    solely in a computer program then the subject matter is not
    patentable in whatever manner it may be presented in the claims."



More information about the erlang-questions mailing list