From b79ce7e6594259669763251e3cbf4404a6381d7c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 17 Oct 2009 22:42:55 -0700 Subject: DRY setting of rack.multithread It's more fool-proof this way and prevents us from using idiotic/non-obvious concurrency model names. --- lib/rainbows/http_server.rb | 1 + lib/rainbows/thread_pool.rb | 1 - lib/rainbows/thread_spawn.rb | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb index fc51ac3..6d61228 100644 --- a/lib/rainbows/http_server.rb +++ b/lib/rainbows/http_server.rb @@ -32,6 +32,7 @@ module Rainbows raise ArgumentError, "concurrency model #{model.inspect} not supported" extend(mod) Const::RACK_DEFAULTS['rainbows.model'] = @use = model + Const::RACK_DEFAULTS['rack.multithread'] = !!(/Thread/ =~ model.to_s) end def worker_connections(*args) diff --git a/lib/rainbows/thread_pool.rb b/lib/rainbows/thread_pool.rb index 2bae89b..c742e5d 100644 --- a/lib/rainbows/thread_pool.rb +++ b/lib/rainbows/thread_pool.rb @@ -27,7 +27,6 @@ module Rainbows def worker_loop(worker) init_worker_process(worker) - RACK_DEFAULTS["rack.multithread"] = true pool = (1..worker_connections).map { new_worker_thread } m = 0 diff --git a/lib/rainbows/thread_spawn.rb b/lib/rainbows/thread_spawn.rb index fb9ea57..104e764 100644 --- a/lib/rainbows/thread_spawn.rb +++ b/lib/rainbows/thread_spawn.rb @@ -21,7 +21,6 @@ module Rainbows def worker_loop(worker) init_worker_process(worker) - RACK_DEFAULTS["rack.multithread"] = true threads = ThreadGroup.new alive = worker.tmp m = 0 -- cgit v1.2.3-24-ge0c7