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

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