Sha256: 2a85fbc492134f688ccce2d53aee736c6dae6569ab883a830e741ee46f2714dc

Contents?: true

Size: 667 Bytes

Versions: 1

Compression:

Stored size: 667 Bytes

Contents

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 = Mailbox.new

        thread = thread_root.new do
          yield mailbox.actor(thread_root.current)
        end

        mailbox.sender(thread)
      end

      # Return an private actor for current thread
      #
      # @return [Actor::Private]
      #
      # @api private
      #
      def current
        Mailbox.new.actor(thread_root.current)
      end

    end # Env
  end # Actor
end # Mutant

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mutant-0.7.1 lib/mutant/actor/env.rb