Sha256: 145eccf4bd520c6c837201b6e8b253d844df39d0e68aa55ff1a107c34d82ab63

Contents?: true

Size: 723 Bytes

Versions: 8

Compression:

Stored size: 723 Bytes

Contents

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.16 lib/mutant/actor/mailbox.rb
mutant-0.8.15 lib/mutant/actor/mailbox.rb
mutant-0.8.14 lib/mutant/actor/mailbox.rb
mutant-0.8.13 lib/mutant/actor/mailbox.rb
mutant-0.8.12 lib/mutant/actor/mailbox.rb
mutant-0.8.11 lib/mutant/actor/mailbox.rb
mutant-0.8.10 lib/mutant/actor/mailbox.rb
mutant-0.8.9 lib/mutant/actor/mailbox.rb