remove support for Sunshowers
[rainbows.git] / lib / rainbows / coolio_fiber_spawn.rb
blob52b3e63b700c52d4a3ebea20d02fd8a399f8d9ed
1 # -*- encoding: binary -*-
2 require 'rainbows/fiber/coolio'
4 # A combination of the Coolio and FiberSpawn models.  This allows Ruby
5 # 1.9 Fiber-based concurrency for application processing while exposing
6 # a synchronous execution model and using scalable network concurrency
7 # provided by Cool.io.  A streaming "rack.input" is exposed.
8 # Applications are strongly advised to wrap all slow IO objects
9 # (sockets, pipes) using the Rainbows::Fiber::IO or a Cool.io-compatible
10 # class whenever possible.
11 module Rainbows::CoolioFiberSpawn
13   include Rainbows::Base
14   include Rainbows::Fiber::Coolio
16   def worker_loop(worker) # :nodoc:
17     Rainbows::Response.setup(Server)
18     init_worker_process(worker)
19     Server.const_set(:MAX, @worker_connections)
20     Rainbows::Fiber::Base.setup(Server, nil)
21     Server.const_set(:APP, Rainbows.server.app)
22     Heartbeat.new(1, true).attach(Coolio::Loop.default)
23     LISTENERS.map! { |s| Server.new(s).attach(Coolio::Loop.default) }
24     Coolio::Loop.default.run
25   end
26 end