Sha256: 4f359daf822ca9e9aab19dfe7a0ea376cdd8e814204e54f8ac20e9976d517913

Contents?: true

Size: 507 Bytes

Versions: 8

Compression:

Stored size: 507 Bytes

Contents

module Mutant
  module Actor

    # Sender for messages to acting thread
    class Sender
      include Adamantium::Flat, Concord.new(:condition_variable, :mutex, :messages)

      # Send a message to actor
      #
      # @param [Object] message
      #
      # @return [self]
      #
      # @api private
      def call(message)
        mutex.synchronize do
          messages << message
          condition_variable.signal
        end

        self
      end

    end # Sender
  end # Actor
end # Mutant

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.8.8 lib/mutant/actor/sender.rb
mutant-0.8.7 lib/mutant/actor/sender.rb
mutant-0.8.6 lib/mutant/actor/sender.rb
mutant-0.8.5 lib/mutant/actor/sender.rb
mutant-0.8.4 lib/mutant/actor/sender.rb
mutant-0.8.3 lib/mutant/actor/sender.rb
mutant-0.8.2 lib/mutant/actor/sender.rb
mutant-0.8.1 lib/mutant/actor/sender.rb