diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-10 08:04:48 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-10 08:04:48 +0000 |
commit | d3b97d1114e2d23a9231fe889cd5bf6927d451ba (patch) | |
tree | 6c4d7a033dad1edc91b72a9e7fa36203c60c8116 /lib/rainbows/rev_thread_pool.rb | |
parent | 9838b614621bbbff27a91166406d833be85adbbd (diff) | |
download | rainbows-d3b97d1114e2d23a9231fe889cd5bf6927d451ba.tar.gz |
Since we suck at building websites, we just rely on RDoc as a website builder. And since Rainbows! is an application server (and not a programming library), our internal API should be of little interest to end users. Anybody interested in Rainbows! (or any other project) internals should be reading the source.
Diffstat (limited to 'lib/rainbows/rev_thread_pool.rb')
-rw-r--r-- | lib/rainbows/rev_thread_pool.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/rainbows/rev_thread_pool.rb b/lib/rainbows/rev_thread_pool.rb index 918b57a..5a7ff82 100644 --- a/lib/rainbows/rev_thread_pool.rb +++ b/lib/rainbows/rev_thread_pool.rb @@ -20,17 +20,19 @@ module Rainbows module RevThreadPool + # :stopdoc: DEFAULTS = { :pool_size => 20, # same default size as ThreadPool (w/o Rev) } + #:startdoc: - def self.setup + def self.setup # :nodoc: 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 - class PoolWatcher < ::Rev::TimerWatcher + class PoolWatcher < ::Rev::TimerWatcher # :nodoc: all def initialize(threads) @threads = threads super(G.server.timeout, true) @@ -41,7 +43,7 @@ module Rainbows end end - class Client < Rainbows::Rev::ThreadClient + class Client < Rainbows::Rev::ThreadClient # :nodoc: def app_dispatch QUEUE << self end @@ -49,7 +51,7 @@ module Rainbows include Rainbows::Rev::Core - def init_worker_threads(master, queue) + def init_worker_threads(master, queue) # :nodoc: O[:pool_size].times.map do Thread.new do begin @@ -62,7 +64,7 @@ module Rainbows end end - def init_worker_process(worker) + def init_worker_process(worker) # :nodoc: super master = Rev::Master.new(Queue.new).attach(::Rev::Loop.default) queue = Client.const_set(:QUEUE, Queue.new) |