Sha256: 3a44ff8de0babc964a62af18444769712402073e366e802dfa56fdd3430dc06e

Contents?: true

Size: 594 Bytes

Versions: 15

Compression:

Stored size: 594 Bytes

Contents

module Celluloid
  # Event signaling between methods of the same object
  class Signals
    def initialize
      @conditions = {}
    end

    # Wait for the given signal and return the associated value
    def wait(name)
      raise "cannot wait for signals while exclusive" if Celluloid.exclusive?

      @conditions[name] ||= Condition.new
      @conditions[name].wait
    end

    # Send a signal to all method calls waiting for the given name
    def broadcast(name, value = nil)
      if condition = @conditions.delete(name)
        condition.broadcast(value)
      end
    end
  end
end

Version data entries

15 entries across 13 versions & 5 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/celluloid-0.16.0/lib/celluloid/signals.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/celluloid-0.16.0/lib/celluloid/signals.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/signals.rb
scoot-0.0.4 .bundle/gems/ruby/2.2.0/gems/celluloid-0.16.0/lib/celluloid/signals.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/celluloid-0.16.0/lib/celluloid/signals.rb
celluloid-0.16.0 lib/celluloid/signals.rb
celluloid-0.16.0.pre3 lib/celluloid/signals.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/celluloid-0.15.2/lib/celluloid/signals.rb
celluloid-0.16.0.pre2 lib/celluloid/signals.rb
celluloid-0.16.0.pre lib/celluloid/signals.rb
celluloid-0.15.2 lib/celluloid/signals.rb
celluloid-0.15.1 lib/celluloid/signals.rb
celluloid-0.15.0 lib/celluloid/signals.rb
celluloid-0.15.0.pre2 lib/celluloid/signals.rb
celluloid-0.15.0.pre lib/celluloid/signals.rb