Sha256: 4e60b98688f0ad14d826d9ac27f179542ca97b00ff4949f2eb4d63a97980b627

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

# encoding: utf-8

require 'eio'

# The call to EIO.wait blocks until callbacks for all completed requests have been invoked. This workflow
# is comparable to a 100m race with each line representing a libeio request and EIO.wait being the
# finishing line / completion barrier. Each I/O operation may be scheduled on a different core and will
# complete in parallel, proportional to the slowest request, with some minor overhead to boot.

class EIO::Middleware
  def initialize(app, opts = {})
     @app = app
     @options = opts
  end

  def call(env)
    ret = @app.call(env)
    EIO.wait # flush the libeio request queue (blocks until all requests have been processed)
    ret
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eio-0.1 lib/eio/middleware.rb