Sha256: 211b72eb3f463b62ce5d63be72a3af37d9441d237c1e7b91c12d36b204e7aa35

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

# -*- encoding: binary -*-
require 'rainbows/fiber/rev'

module Rainbows

  # A combination of the Rev and FiberSpawn models.  This allows Ruby
  # 1.9 Fiber-based concurrency for application processing while
  # exposing a synchronous execution model and using scalable network
  # concurrency provided by Rev.  A "rack.input" is exposed as well
  # being Sunshowers-compatible.  Applications are strongly advised to
  # wrap all slow IO objects (sockets, pipes) using the
  # Rainbows::Fiber::IO or a Rev-compatible class whenever possible.
  module RevFiberSpawn

    include Base
    include Fiber::Rev

    def worker_loop(worker)
      init_worker_process(worker)
      Server.const_set(:MAX, @worker_connections)
      Server.const_set(:APP, G.server.app)
      Heartbeat.new(1, true).attach(::Rev::Loop.default)
      kato = Kato.new.attach(::Rev::Loop.default)
      Rainbows::Fiber::IO.const_set(:KATO, kato)
      LISTENERS.map! { |s| Server.new(s).attach(::Rev::Loop.default) }
      ::Rev::Loop.default.run
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rainbows-0.94.0 lib/rainbows/rev_fiber_spawn.rb
rainbows-0.93.0 lib/rainbows/rev_fiber_spawn.rb
rainbows-0.92.0 lib/rainbows/rev_fiber_spawn.rb
rainbows-0.91.1 lib/rainbows/rev_fiber_spawn.rb
rainbows-0.91.0 lib/rainbows/rev_fiber_spawn.rb
rainbows-0.90.2 lib/rainbows/rev_fiber_spawn.rb
rainbows-0.90.1 lib/rainbows/rev_fiber_spawn.rb
rainbows-0.90.0 lib/rainbows/rev_fiber_spawn.rb