Sha256: 571a351e351d825b748754fbdcec2e3983c798e96cd151cd092b9c825dafe334

Contents?: true

Size: 754 Bytes

Versions: 8

Compression:

Stored size: 754 Bytes

Contents

# frozen_string_literal: true

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

      # New mailbox
      #
      # @return [Mailbox]
      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]
      def bind(other)
        Binding.new(self, other)
      end

    end # Mailbox
  end # Actor
end # Mutant

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.8.24 lib/mutant/actor/mailbox.rb
mutant-0.8.23 lib/mutant/actor/mailbox.rb
mutant-0.8.22 lib/mutant/actor/mailbox.rb
mutant-0.8.21 lib/mutant/actor/mailbox.rb
mutant-0.8.20 lib/mutant/actor/mailbox.rb
mutant-0.8.19 lib/mutant/actor/mailbox.rb
mutant-0.8.18 lib/mutant/actor/mailbox.rb
mutant-0.8.17 lib/mutant/actor/mailbox.rb