mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Add missing localvars. Accessing localvars is faster than accessing ivars
This commit is contained in:
parent
ca21111666
commit
fb4e23d628
1 changed files with 6 additions and 4 deletions
|
@ -53,15 +53,17 @@ module Puma
|
||||||
@spawned += 1
|
@spawned += 1
|
||||||
|
|
||||||
th = Thread.new do
|
th = Thread.new do
|
||||||
todo = @todo
|
todo = @todo
|
||||||
block = @block
|
block = @block
|
||||||
|
mutex = @mutex
|
||||||
|
cond = @cond
|
||||||
|
|
||||||
while true
|
while true
|
||||||
work = nil
|
work = nil
|
||||||
|
|
||||||
continue = true
|
continue = true
|
||||||
|
|
||||||
@mutex.synchronize do
|
mutex.synchronize do
|
||||||
while todo.empty?
|
while todo.empty?
|
||||||
if @trim_requested > 0
|
if @trim_requested > 0
|
||||||
@trim_requested -= 1
|
@trim_requested -= 1
|
||||||
|
@ -75,7 +77,7 @@ module Puma
|
||||||
end
|
end
|
||||||
|
|
||||||
@waiting += 1
|
@waiting += 1
|
||||||
@cond.wait @mutex
|
cond.wait mutex
|
||||||
@waiting -= 1
|
@waiting -= 1
|
||||||
|
|
||||||
if @shutdown
|
if @shutdown
|
||||||
|
@ -92,7 +94,7 @@ module Puma
|
||||||
block.call work
|
block.call work
|
||||||
end
|
end
|
||||||
|
|
||||||
@mutex.synchronize do
|
mutex.synchronize do
|
||||||
@spawned -= 1
|
@spawned -= 1
|
||||||
@workers.delete th
|
@workers.delete th
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue