writer_thread_pool: remove unnecesary debug messages
[rainbows.git] / lib / rainbows / coolio_fiber_spawn.rb
blob9c5af5f7bf677d11f5391d17f7c7a487116451b2
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
6 # exposing a synchronous execution model and using scalable network
7 # concurrency provided by Cool.io.  A "rack.input" is exposed as well
8 # being Sunshowers-compatible.  Applications are strongly advised to
9 # wrap all slow IO objects (sockets, pipes) using the
10 # Rainbows::Fiber::IO or a Cool.io-compatible 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, G.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