From 180485d49ea858f83ef2a28a9e07224aa514edc7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 22 Oct 2010 16:21:03 -0700 Subject: unindent most files This simplifies and disambiguates most constant resolution issues as well as lowering our identation level. Hopefully this makes code easier to understand. --- lib/rainbows/rev_fiber_spawn.rb | 45 +++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 24 deletions(-) (limited to 'lib/rainbows/rev_fiber_spawn.rb') diff --git a/lib/rainbows/rev_fiber_spawn.rb b/lib/rainbows/rev_fiber_spawn.rb index 522ae71..39483b3 100644 --- a/lib/rainbows/rev_fiber_spawn.rb +++ b/lib/rainbows/rev_fiber_spawn.rb @@ -1,31 +1,28 @@ # -*- 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 Rainbows::RevFiberSpawn - # 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 Rainbows::Base + include Rainbows::Fiber::Rev - include Base - include Fiber::Rev - - def worker_loop(worker) # :nodoc: - Rainbows::Response.setup(Rainbows::Fiber::Rev::Server) - init_worker_process(worker) - Server.const_set(:MAX, @worker_connections) - Rainbows::Fiber::Base.setup(Rainbows::Fiber::Rev::Server, nil) - Server.const_set(:APP, G.server.app) - Heartbeat.new(1, true).attach(::Rev::Loop.default) - kato = Kato.new.attach(::Rev::Loop.default) - Rainbows::Fiber::Rev::Methods.const_set(:KATO, kato) - LISTENERS.map! { |s| Server.new(s).attach(::Rev::Loop.default) } - ::Rev::Loop.default.run - end + def worker_loop(worker) # :nodoc: + Rainbows::Response.setup(Server) + init_worker_process(worker) + Server.const_set(:MAX, @worker_connections) + Rainbows::Fiber::Base.setup(Server, nil) + Server.const_set(:APP, G.server.app) + Heartbeat.new(1, true).attach(Rev::Loop.default) + kato = Kato.new.attach(Rev::Loop.default) + Rainbows::Fiber::Rev::Methods.const_set(:KATO, kato) + LISTENERS.map! { |s| Server.new(s).attach(Rev::Loop.default) } + Rev::Loop.default.run end end -- cgit v1.2.3-24-ge0c7