From e2d4ebdea4eab41c4af1c5530a9e180d11529dec Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 27 Dec 2007 11:17:05 +0000 Subject: Introduce native mongrel handler and push mutex into dispatcher. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8488 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/dispatcher.rb | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/dispatcher.rb b/actionpack/lib/action_controller/dispatcher.rb index c8656e4bab..4f1094e497 100644 --- a/actionpack/lib/action_controller/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatcher.rb @@ -2,6 +2,8 @@ module ActionController # Dispatches requests to the appropriate controller and takes care of # reloading the app after each request when Dependencies.load? is true. class Dispatcher + @@guard = Mutex.new + class << self # Backward-compatible class method takes CGI-specific args. Deprecated # in favor of Dispatcher.new(output, request, response).dispatch. @@ -111,12 +113,16 @@ module ActionController end def dispatch - run_callbacks :before - handle_request - rescue Exception => exception - failsafe_rescue exception - ensure - run_callbacks :after, :reverse_each + @@guard.synchronize do + begin + run_callbacks :before + handle_request + rescue Exception => exception + failsafe_rescue exception + ensure + run_callbacks :after, :reverse_each + end + end end def dispatch_cgi(cgi, session_options) -- cgit v1.2.3