[erlang-questions] gen_server2 merge into OTP?

Matthew Sackman <>
Sat Jul 18 12:38:45 CEST 2009


On Sat, Jul 18, 2009 at 10:44:35AM +0200, Ulf Wiger wrote:
> Hmm, there was a question on the list just recently which
> touched on how erl_eval drains the messages and resends
> them to itself, and how this severely punishes code where
> selective receive is /not/ used.

The purpose of gen_server2 is a) to allow message priorities to be used;
b) to make sure that when you do a call to another process, you don't
risk having to scan a huge mailbox when the reply comes back because the
mailbox is always kept small as it's constantly drained into our own
priority queue.

If you want to see an even funkier version of gen_server2, try
http://hg.rabbitmq.com/rabbitmq-server/file/dc753bc0c54e/src/gen_server2.erl
;)

Matthew


More information about the erlang-questions mailing list