[erlang-questions] Message Receive Semantics (was eep: Multiple Patterns)

Christian S <>
Sun Jun 1 13:03:05 CEST 2008


> ...can anyone clarify for me why you would wish to retain messages in
> the process mailbox that the process didn't wish to receive or act
> upon?

Having one receive-clause retain messages doesnt mean that you have to
make all do it.

So it is a matter of the process only wanting to handle a certain kind
of message _at this time_.

A perfect example of a selective receive is in a gen_server:call, you
want the reply to your request back, not the next message in the
mailbox.



More information about the erlang-questions mailing list