How is a mailbox (message queue) implemented in Scala Actors?

Behind the scenes, how is a mailbox (actor's message queue) implemented in Scala Actors?

I thought it was MessageQueue, but it is deprecated with a note saying that "this class will be removed in a future version." It looks like it might be in Channel, but I need details on how the message queue itself is implemented.

+5
source share
1 answer

See: http://lampsvn.epfl.ch/trac/scala/browser/scala/tags/R_2_8_0_final/src/library/scala/concurrent/MailBox.scala
It looks like this is just a linked list that bypasses if there is a waiting receiver when sending. Senders and recipients are synchronized on the MailBox, and senders notify of awakening pending receivers.

+3
source

All Articles