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

Ulf Wiger <>
Sun Jun 1 12:59:47 CEST 2008


Steve,

The simplest (and most ubiquitous) case is
gen_server:call().

The function gen:await_resp(...) uses pattern matching
to check different messages that relate to the request
sent. It touches no other messages.

It's a form of scoped receive, and there are of course
other ways to achieve the same thing.

BR,
Ulf W

2008/6/1 Steve <>:
> At the risk of sounding like a "dumb noob" (which is, actually, pretty
> much what I am)...
>
> ...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?
>
> It struck me from the get-go when learning about Erlang that I could
> not think of a use case for this mode of operation, and it always
> seemed to me to be a touch dangerous (and a good way to break an
> unsuspecting application).
>
> Yes - I'm asking why the erlang messaging works the way it does.
>
> /Steve
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list