aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/lock.rb
blob: b4b0902f18c8783c2d9ef645ce05500f59c800ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module ActionController
  class Lock
    def initialize(app)
      @app = app
      @lock = Mutex.new
    end

    def call(env)
      old_multithread = env["rack.multithread"]
      env["rack.multithread"] = false
      response = @lock.synchronize do
        @app.call(env)
      end
      env["rack.multithread"] = old_multithread
      response
    end
  end
end