Sha256: e2fa283d0be2aa29ae6a8a151a41a1214f3b5aee3bc43d979a9b4c362c8d870a

Contents?: true

Size: 444 Bytes

Versions: 1

Compression:

Stored size: 444 Bytes

Contents

require 'fiber'

# Method and concept from em-synchrony
# https://github.com/igrigorik/em-synchrony
#
# 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
module EventMachine
  def self.fiber_run(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
protobuf-1.0.1 lib/protobuf/ext/eventmachine.rb