about summary refs log tree commit homepage
path: root/lib/mongrel/rails.rb
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-06-05 08:54:06 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-06-05 08:54:06 +0000
commitfbf042877dd1690b0202d38cba29c6e7f9f0a0d6 (patch)
tree949756da1ed118cc341dc3b049588c83b768cf46 /lib/mongrel/rails.rb
parent05a11e01bae2f58357df5afc7595acc95ef79a9c (diff)
downloadunicorn-fbf042877dd1690b0202d38cba29c6e7f9f0a0d6.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@225 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'lib/mongrel/rails.rb')
-rw-r--r--lib/mongrel/rails.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/mongrel/rails.rb b/lib/mongrel/rails.rb
index 8ebd76d..f108236 100644
--- a/lib/mongrel/rails.rb
+++ b/lib/mongrel/rails.rb
@@ -77,10 +77,9 @@ module Mongrel
             cgi = Mongrel::CGIWrapper.new(request, response)
             cgi.handler = self
 
-            @guard.synchronize do
-              # Rails is not thread safe so must be run entirely within synchronize
-              Dispatcher.dispatch(cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, response.body)
-            end
+            @guard.lock unless ActionController::Base.allow_concurrency
+            # Rails is not thread safe so must be run entirely within synchronize
+            Dispatcher.dispatch(cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, response.body)
 
             # This finalizes the output using the proper HttpResponse way
             cgi.out {""}
@@ -89,6 +88,8 @@ module Mongrel
           rescue Object => rails_error
             STDERR.puts "Error calling Dispatcher.dispatch #{rails_error.inspect}"
             STDERR.puts rails_error.backtrace.join("\n")
+          ensure
+            @guard.unlock
           end
         end
       end