mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Merge pull request #1563 from dannyfallon/df/threadpool-race-fix
Meter accept(2) while taking into account races around thread pool mutex
This commit is contained in:
commit
3f0b725488
1 changed files with 3 additions and 3 deletions
|
@ -157,12 +157,12 @@ module Puma
|
|||
@mutex.synchronize do
|
||||
while true
|
||||
return if @shutdown
|
||||
return if @waiting > 0
|
||||
|
||||
# If we can still spin up new threads and there
|
||||
# is work queued, then accept more work until we would
|
||||
# is work queued that cannot be handled by waiting
|
||||
# threads, then accept more work until we would
|
||||
# spin up the max number of threads.
|
||||
return if @todo.size < @max - @spawned
|
||||
return if @todo.size - @waiting < @max - @spawned
|
||||
|
||||
@not_full.wait @mutex
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue