Module: EventMachine

Defined in:
lib/protobuf/ext/eventmachine.rb

Overview

Method 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

Class Method Summary collapse

Class Method Details

.fiber_run(blk = nil, tail = nil, &block) ⇒ Object



10
11
12
13
# File 'lib/protobuf/ext/eventmachine.rb', line 10

def self.fiber_run(blk=nil, tail=nil, &block)
  context = Proc.new{ Fiber.new{ (b = blk || block) and b.call }.resume }
  self.run(context, tail)
end