提交 f0c7e2b8 编写于 作者: M Matthew Draper 提交者: GitHub

Merge pull request #24146 from matthewd/latch-as-proxy

Don't inherit from Concurrent::CountDownLatch
......@@ -2,17 +2,24 @@
module ActiveSupport
module Concurrency
class Latch < Concurrent::CountDownLatch
class Latch
def initialize(count = 1)
ActiveSupport::Deprecation.warn("ActiveSupport::Concurrency::Latch is deprecated. Please use Concurrent::CountDownLatch instead.")
super(count)
if count == 1
ActiveSupport::Deprecation.warn("ActiveSupport::Concurrency::Latch is deprecated. Please use Concurrent::Event instead.")
else
ActiveSupport::Deprecation.warn("ActiveSupport::Concurrency::Latch is deprecated. Please use Concurrent::CountDownLatch instead.")
end
@inner = Concurrent::CountDownLatch.new(count)
end
alias_method :release, :count_down
def release
@inner.count_down
end
def await
wait(nil)
@inner.wait(nil)
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册