0d8f680d4f
SVG-Edit -> 2.5final Vendored Rack -> 1.2.1
19 lines
314 B
Ruby
19 lines
314 B
Ruby
require 'thread'
|
|
|
|
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
|