From 40445641f11f01c6a24bf96c8b80eed5fd33a512 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 28 Dec 2010 17:59:27 -0800 Subject: complete Rev => Coolio renaming We use Cool.io internally everywhere now, but preserve Rev-based models for anybody using them. --- lib/rainbows/rev_thread_pool.rb | 45 ++++------------------------------------- 1 file changed, 4 insertions(+), 41 deletions(-) (limited to 'lib/rainbows/rev_thread_pool.rb') diff --git a/lib/rainbows/rev_thread_pool.rb b/lib/rainbows/rev_thread_pool.rb index 4366086..844651a 100644 --- a/lib/rainbows/rev_thread_pool.rb +++ b/lib/rainbows/rev_thread_pool.rb @@ -1,4 +1,7 @@ # -*- encoding: binary -*- +# :stopdoc: +Rainbows.const_set(:RevThreadPool, Rainbows::CoolioThreadPool) +# :startdoc: # CoolioThreadPool is the new version of this, use that instead. # @@ -16,44 +19,4 @@ # # This concurrency model is designed for Ruby 1.9, and Ruby 1.8 # users are NOT advised to use this due to high CPU usage. -module Rainbows::RevThreadPool - - # :stopdoc: - DEFAULTS = { - :pool_size => 20, # same default size as ThreadPool (w/o Rev) - } - #:startdoc: - - def self.setup # :nodoc: - o = Rainbows::O - DEFAULTS.each { |k,v| o[k] ||= v } - Integer === o[:pool_size] && o[:pool_size] > 0 or - raise ArgumentError, "pool_size must a be an Integer > 0" - end - include Rainbows::Rev::Core - - def init_worker_threads(master, queue) # :nodoc: - Rainbows::O[:pool_size].times.map do - Thread.new do - begin - client = queue.pop - master << [ client, client.app_response ] - rescue => e - Rainbows::Error.listen_loop(e) - end while true - end - end - end - - def init_worker_process(worker) # :nodoc: - super - master = Rainbows::Rev::Master.new(Queue.new).attach(Rev::Loop.default) - queue = Rainbows::RevThreadPool::Client.const_set(:QUEUE, Queue.new) - threads = init_worker_threads(master, queue) - Rainbows::RevThreadPool::Watcher.new(threads).attach(Rev::Loop.default) - logger.info "RevThreadPool pool_size=#{Rainbows::O[:pool_size]}" - end -end -# :enddoc: -require 'rainbows/rev_thread_pool/client' -require 'rainbows/rev_thread_pool/watcher' +module Rainbows::RevThreadPool; end -- cgit v1.2.3-24-ge0c7