Sha256: 8e659a407fc915888716843738070665b16c27841abf58591b1d8e9569cb1f71

Contents?: true

Size: 660 Bytes

Versions: 1

Compression:

Stored size: 660 Bytes

Contents

$:.unshift(File.dirname(__FILE__) + '/../lib')

require "eventmachine"

begin
  require "fiber"
rescue LoadError => error
  raise error unless defined? Fiber
end

require "em-synchrony/em-multi"
require "em-synchrony/connection_pool"
# require "em-synchrony/iterator" # iterators are not release in EM yet

module EventMachine

  # A convenience method for wrapping EM.run body within
  # a Ruby Fiber such that async operations can be transparently
  # paused and resumed based on IO scheduling.
  def self.synchrony(blk=nil, tail=nil, &block)
    blk ||= block
    context = Proc.new { Fiber.new { blk.call }.resume }

    self.run(context, tail)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-synchrony-0.1.5 lib/em-synchrony.rb