blob: ce8fdf91ead3332961ae05696442fbba0a9a0ec5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# frozen_string_literal: true
require 'logger'
module Rack
# Sets up rack.logger to write to rack.errors stream
class Lock
class Wrapper
def initialize(app)
@app = app
@mutex = ::Thread::Mutex.new
end
def call(env)
@mutex.synchronize do
@app.call(env)
end
end
end
def self.rackup(builder)
if builder.multithread?
builder.use(Wrapper)
end
end
end
end
|