Sha256: bdf55a54c8d8349468459c7f2ce14016534bfdc3e5eea05b5a646dd3a175f677

Contents?: true

Size: 464 Bytes

Versions: 40

Compression:

Stored size: 464 Bytes

Contents

class Wire < Fiber
  # We cannot run this fiber explicitly because EM schedules it. Resuming the
  # current fiber on the next tick to let the reactor do work.
  def self.pass
    f = Fiber.current
    EM.next_tick { f.resume }
    Fiber.yield
  end

  def self.sleep(sec)
    EM::Synchrony.sleep(sec)
  end

  def initialize(&blk)
    super

    # Schedule run in next tick
    EM.next_tick { resume }
  end

  def join
    self.class.pass while alive?
  end
end

Version data entries

40 entries across 39 versions & 10 rubygems

Version Path
finsync_redis-3.3.5 test/support/wire/synchrony.rb
redis-4.0.3 test/support/wire/synchrony.rb
redis-4.1.0.beta1 test/support/wire/synchrony.rb
redis-4.0.2 test/support/wire/synchrony.rb
redis-3.3.5 test/support/wire/synchrony.rb
redis-4.0.1 test/support/wire/synchrony.rb
redis-4.0.0 test/support/wire/synchrony.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/redis-3.3.3/test/support/wire/synchrony.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/redis-3.3.3/test/support/wire/synchrony.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/redis-3.3.3/test/support/wire/synchrony.rb
logstash-filter-cache-redis-0.1.0 vendor/bundle/jruby/1.9/gems/redis-3.3.3/test/support/wire/synchrony.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/redis-3.3.3/test/support/wire/synchrony.rb
redis-3.3.3 test/support/wire/synchrony.rb
abaci-0.3.0 vendor/bundle/gems/redis-3.3.2/test/support/wire/synchrony.rb
abaci-0.3.0 vendor/bundle/gems/redis-3.3.1/test/support/wire/synchrony.rb
redis-4.0.0.rc1 test/support/wire/synchrony.rb
redis-3.3.2 test/support/wire/synchrony.rb
redis-3.3.1 test/support/wire/synchrony.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/test/support/wire/synchrony.rb
redis-3.3.0 test/support/wire/synchrony.rb