aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/concurrency/latch.rb
blob: 7b8df0df049e2c84e5b488f02ded79b10bb80367 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'concurrent/atomics'

module ActiveSupport
  module Concurrency
    class Latch < Concurrent::CountDownLatch

      def initialize(count = 1)
        ActiveSupport::Deprecation.warn("ActiveSupport::Concurrency::Latch is deprecated. Please use Concurrent::CountDownLatch instead.")
        super(count)
      end
      
      alias_method :release, :count_down

      def await
        wait(nil)
      end
    end
  end
end