about summary refs log tree commit homepage
path: root/lib/rainbows/never_block/core.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-26 23:16:41 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-26 23:33:22 +0000
commit6733af0546a759b73fd63880e8ef2549caf4c4f2 (patch)
tree80e9887968a53b25f6f7c6f645d8a43200801408 /lib/rainbows/never_block/core.rb
parent20e8d57127f16da8e4242582dee3b99d54cbb729 (diff)
downloadrainbows-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.rb15
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