Ulf Wiger <>
Tue Jan 28 11:10:08 CET 2003

On Tue, 28 Jan 2003, Per Bergqvist wrote:

>Except that the tag is changed from '$gen_cast' to 'cast'
>etc. isn't this equivalent to a receive ... after 0 ?

It's supposed to be the semantic equivalent of receive ...
after 0, except for a couple of details:

- gen_server handles some messages in a special way.
  These messages are (a) EXIT from the parent, and
  (b) system messages. Inadvertedly consuming and
  perhaps discarding these messages can have very bad
  effects on the system.
- It's difficult to write a receive clause that fetches
  calls, casts and info messages without also consuming
  the other messages. It can be done, but you really have
  to give it some thought.
- The gen_server API doesn't define what messages are
  special, what are the invariants of the internal
  gen_server messages, or what one is really allowed to
  do with the messages that gen_server cares about.

Ulf Wiger, Senior Specialist,
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson Telecom AB, ATM Multiservice Networks

More information about the erlang-questions mailing list