diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-12-26 23:16:41 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-12-26 23:33:22 +0000 |
commit | 6733af0546a759b73fd63880e8ef2549caf4c4f2 (patch) | |
tree | 80e9887968a53b25f6f7c6f645d8a43200801408 /lib/rainbows/never_block/core.rb | |
parent | 20e8d57127f16da8e4242582dee3b99d54cbb729 (diff) | |
download | rainbows-6733af0546a759b73fd63880e8ef2549caf4c4f2.tar.gz |
alias_method is a mess, super is superb!
Diffstat (limited to 'lib/rainbows/never_block/core.rb')
-rw-r--r-- | lib/rainbows/never_block/core.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/rainbows/never_block/core.rb b/lib/rainbows/never_block/core.rb new file mode 100644 index 0000000..7188f75 --- /dev/null +++ b/lib/rainbows/never_block/core.rb @@ -0,0 +1,15 @@ +# -*- encoding: binary -*- +# :enddoc: +module Rainbows::NeverBlock::Core + def init_worker_process(worker) + super + o = Rainbows::O + pool = NB::Pool::FiberPool.new(o[:pool_size]) + base = o[:backend].to_s.gsub!(/([a-z])([A-Z])/, '\1_\2').downcase! + require "rainbows/never_block/#{base}" + client_class = Rainbows::NeverBlock::Client + client_class.superclass.const_set(:APP, Rainbows::G.server.app) + client_class.const_set(:POOL, pool) + logger.info "NeverBlock/#{o[:backend]} pool_size=#{o[:pool_size]}" + end +end |