blob: 53e09b685c7d3b5b3ed04d6a79bebf6f460e3587 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
require "concurrent/atomic/count_down_latch"
module ActiveSupport
module Concurrency
class Latch
def initialize(count = 1)
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
def release
@inner.count_down
end
def await
@inner.wait(nil)
end
end
end
end
|