提交 4db4f909 编写于 作者: A Aaron Patterson

use a latch to avoid busy loops

上级 8f218266
require "cases/helper"
require 'active_support/concurrency/latch'
module ActiveRecord
module ConnectionAdapters
......@@ -133,15 +134,15 @@ def test_reap_and_active
end
def test_reap_inactive
ready = false
ready = ActiveSupport::Concurrency::Latch.new
@pool.checkout
child = Thread.new do
@pool.checkout
@pool.checkout
ready = true
ready.release
Thread.stop
end
Thread.pass until ready
ready.await
assert_equal 3, active_connections(@pool).size
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册