module

Earl::Mailbox(M)

Extends an agent with a mailbox that receives messages of type M.

NOTE: agents must use the #receive : M and #receive? : M? methods to take messages from the mailbox —undocumented because they're protected.

Instance methods

mailbox=(mailbox : Channel(M)) : Channel(M)

Replaces the mailbox. The mailbox won't be closed automatically when the agent is asked to stop.

send(message : M) : Nil

Send a message to the Agent. Raises if the mailbox is closed.