diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-10-14 17:39:10 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-10-14 17:39:55 -0700 |
commit | 6edaf2b720743fa0ce751b45a0923712b8ed5909 (patch) | |
tree | 1ffb61d2806e9da923850a9ac0954ba89a706e88 /lib/rainbows | |
parent | 09eaa39fe7f1f5eb0a6d8aa4fab79afe6ff572a4 (diff) | |
download | rainbows-6edaf2b720743fa0ce751b45a0923712b8ed5909.tar.gz |
Enabling thread-safe or thread-aware code paths in applications may even be dangerous in some cases and cause deadlocks in code that otherwise does not expect threads. This is especially true of the Revactor case where being a "drop-in" replacement for IO routines is dangerous if a mutex is held while an Actor performs a "blocking" I/O operation. Basically start to assume that anybody writing an app using Rev or Revactor already takes Rev/Revactor concurrency into account and won't need the rack.multithread flag set to do special things.
Diffstat (limited to 'lib/rainbows')
-rw-r--r-- | lib/rainbows/const.rb | 5 | ||||
-rw-r--r-- | lib/rainbows/thread_pool.rb | 1 | ||||
-rw-r--r-- | lib/rainbows/thread_spawn.rb | 1 |
3 files changed, 2 insertions, 5 deletions
diff --git a/lib/rainbows/const.rb b/lib/rainbows/const.rb index 1b5c3a8..648d90e 100644 --- a/lib/rainbows/const.rb +++ b/lib/rainbows/const.rb @@ -8,11 +8,6 @@ module Rainbows include Unicorn::Const RACK_DEFAULTS = ::Unicorn::HttpRequest::DEFAULTS.merge({ - - # we need to observe many of the rules for thread-safety even - # with Revactor or Rev, so we're considered multithread-ed even - # when we're not technically... - "rack.multithread" => true, "SERVER_SOFTWARE" => "Rainbows! #{RAINBOWS_VERSION}", }) diff --git a/lib/rainbows/thread_pool.rb b/lib/rainbows/thread_pool.rb index ba85051..50d0322 100644 --- a/lib/rainbows/thread_pool.rb +++ b/lib/rainbows/thread_pool.rb @@ -20,6 +20,7 @@ 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 05068fc..f14ed1c 100644 --- a/lib/rainbows/thread_spawn.rb +++ b/lib/rainbows/thread_spawn.rb @@ -15,6 +15,7 @@ module Rainbows def worker_loop(worker) init_worker_process(worker) + RACK_DEFAULTS["rack.multithread"] = true threads = ThreadGroup.new alive = worker.tmp m = 0 |