2015-11-02 21:30:50 -05:00
|
|
|
require 'concurrent/atomic/count_down_latch'
|
2012-07-29 20:26:07 -04:00
|
|
|
|
|
|
|
module ActiveSupport
|
|
|
|
module Concurrency
|
2015-07-13 14:22:54 -04:00
|
|
|
class Latch < Concurrent::CountDownLatch
|
2012-07-29 20:26:07 -04:00
|
|
|
|
2015-07-13 14:22:54 -04:00
|
|
|
def initialize(count = 1)
|
|
|
|
ActiveSupport::Deprecation.warn("ActiveSupport::Concurrency::Latch is deprecated. Please use Concurrent::CountDownLatch instead.")
|
|
|
|
super(count)
|
2012-07-29 20:26:07 -04:00
|
|
|
end
|
2015-11-02 21:30:50 -05:00
|
|
|
|
2015-07-13 14:22:54 -04:00
|
|
|
alias_method :release, :count_down
|
2012-07-29 20:26:07 -04:00
|
|
|
|
|
|
|
def await
|
2015-07-13 14:22:54 -04:00
|
|
|
wait(nil)
|
2012-07-29 20:26:07 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|