Sha256: 625e89cbd78728e7e5fe89c42da9af89323ca16727a22d5e8abecb4bc21db89e

Contents?: true

Size: 811 Bytes

Versions: 9

Compression:

Stored size: 811 Bytes

Contents

module Mutant
  module Actor
    # Unbound mailbox
    class Mailbox
      include Adamantium::Flat, Concord::Public.new(:receiver, :sender)

      # Return 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

      # Return 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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mutant-0.8.0 lib/mutant/actor/mailbox.rb
mutant-0.7.9 lib/mutant/actor/mailbox.rb
mutant-0.7.8 lib/mutant/actor/mailbox.rb
mutant-0.7.7 lib/mutant/actor/mailbox.rb
mutant-0.7.6 lib/mutant/actor/mailbox.rb
mutant-0.7.5 lib/mutant/actor/mailbox.rb
mutant-0.7.4 lib/mutant/actor/mailbox.rb
mutant-0.7.3 lib/mutant/actor/mailbox.rb
mutant-0.7.2 lib/mutant/actor/mailbox.rb