diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-01-22 15:13:47 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-01-22 15:13:47 -0600 |
commit | cc0b5fa9930dcc60914e21b518b3c54109243cfa (patch) | |
tree | 3b5c65d8d0329388730542093314028630b0945a /actionpack/lib/action_controller/rack_ext/lock.rb | |
parent | e57cb2629ac4971a5dcb1cf8bb2f6d0509317928 (diff) | |
parent | ccda96093a3bf3fb360f7c6d61bbbf341b2ae034 (diff) | |
download | rails-cc0b5fa9930dcc60914e21b518b3c54109243cfa.tar.gz rails-cc0b5fa9930dcc60914e21b518b3c54109243cfa.tar.bz2 rails-cc0b5fa9930dcc60914e21b518b3c54109243cfa.zip |
Merge branch 'master' into 3-0-unstable
Conflicts:
ci/cruise_config.rb
Diffstat (limited to 'actionpack/lib/action_controller/rack_ext/lock.rb')
-rw-r--r-- | actionpack/lib/action_controller/rack_ext/lock.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/rack_ext/lock.rb b/actionpack/lib/action_controller/rack_ext/lock.rb new file mode 100644 index 0000000000..9bf1889065 --- /dev/null +++ b/actionpack/lib/action_controller/rack_ext/lock.rb @@ -0,0 +1,21 @@ +module Rack + # Rack::Lock was commited to Rack core + # http://github.com/rack/rack/commit/7409b0c + # Remove this when Rack 1.0 is released + unless defined? Lock + class Lock + FLAG = 'rack.multithread'.freeze + + def initialize(app, lock = Mutex.new) + @app, @lock = app, lock + end + + def call(env) + old, env[FLAG] = env[FLAG], false + @lock.synchronize { @app.call(env) } + ensure + env[FLAG] = old + end + end + end +end |