class Rack::Lock

will effectively be executed synchronously.
Rack::Lock locks every request inside a mutex, so that every request

def call(env)

def call(env)
  @mutex.lock
  begin
    response = @app.call(env)
    returned = response << BodyProxy.new(response.pop) { unlock }
  ensure
    unlock unless returned
  end
end

def initialize(app, mutex = Mutex.new)

def initialize(app, mutex = Mutex.new)
  @app, @mutex = app, mutex
end

def unlock

def unlock
  @mutex.unlock
end