free_mutant/lib/mutant/actor/env.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

33 lines
554 B
Ruby

module Mutant
module Actor
# Actor root environment
class Env
include Concord.new(:thread_root)
# Spawn a new actor executing block
#
# @return [Actor::Sender]
#
# @api private
def spawn
mailbox = new_mailbox
thread_root.new do
yield mailbox
end
mailbox.sender
end
# New unbound mailbox
#
# @return [Mailbox]
#
# @api private
def new_mailbox
Mailbox.new
end
end # Env
end # Actor
end # Mutant