aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/concurrency
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-07-02 06:47:38 +0930
committerGitHub <noreply@github.com>2016-07-02 06:47:38 +0930
commitf0c7e2b8c373d36d2a04cce14b9243ea9b67f950 (patch)
tree8679ba7ab0b3e86e7fc3e42b11a247f5e7e33bf2 /activesupport/lib/active_support/concurrency
parent803ee80c88e04f1d9e81ca0dc7e71986b81784af (diff)
parentb50f5a5ac6fc554eaad3138cb42f678a41794771 (diff)
downloadrails-f0c7e2b8c373d36d2a04cce14b9243ea9b67f950.tar.gz
rails-f0c7e2b8c373d36d2a04cce14b9243ea9b67f950.tar.bz2
rails-f0c7e2b8c373d36d2a04cce14b9243ea9b67f950.zip
Merge pull request #24146 from matthewd/latch-as-proxy
Don't inherit from Concurrent::CountDownLatch
Diffstat (limited to 'activesupport/lib/active_support/concurrency')
-rw-r--r--activesupport/lib/active_support/concurrency/latch.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/concurrency/latch.rb b/activesupport/lib/active_support/concurrency/latch.rb
index 4abe5ece6f..35074265b8 100644
--- a/activesupport/lib/active_support/concurrency/latch.rb
+++ b/activesupport/lib/active_support/concurrency/latch.rb
@@ -2,17 +2,24 @@ require 'concurrent/atomic/count_down_latch'
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