free_mutant/lib/mutant/actor/mailbox.rb
Markus Schirp 8335cccafb Fix YARD summary line
* Reduce redunrant 'Return' prefix on summaries
* Improve summary line to reflect the semantics of operation better
2015-07-03 15:21:39 +00:00

36 lines
781 B
Ruby

module Mutant
module Actor
# Unbound mailbox
class Mailbox
include Adamantium::Flat, Concord::Public.new(:receiver, :sender)
# New mailbox
#
# @return [Mailbox]
#
# @api private
def self.new
mutex = Mutex.new
condition_variable = ConditionVariable.new
messages = []
super(
Receiver.new(condition_variable, mutex, messages),
Sender.new(condition_variable, mutex, messages)
)
end
# Binding for RPC to other actors
#
# @param [Actor::Sender] other
#
# @return [Binding]
#
# @api private
def bind(other)
Binding.new(self, other)
end
end # Mailbox
end # Actor
end # Mutant