From 4839fe2e8201835a53ab6c75528a613e8bf25bfb Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 14 Apr 2009 15:52:23 -0500 Subject: Move bundled rack into ActionDispatch --- .../lib/action_dispatch/vendor/rack-1.0/rack/lock.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 actionpack/lib/action_dispatch/vendor/rack-1.0/rack/lock.rb (limited to 'actionpack/lib/action_dispatch/vendor/rack-1.0/rack/lock.rb') diff --git a/actionpack/lib/action_dispatch/vendor/rack-1.0/rack/lock.rb b/actionpack/lib/action_dispatch/vendor/rack-1.0/rack/lock.rb new file mode 100644 index 0000000000..93238528c4 --- /dev/null +++ b/actionpack/lib/action_dispatch/vendor/rack-1.0/rack/lock.rb @@ -0,0 +1,16 @@ +module Rack + 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 -- cgit v1.2.3