class TestMinitestRunner::Latch

Public Class Methods

new(count = 1) click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_test.rb, line 566
def initialize count = 1
  @count = count
  @lock  = Monitor.new
  @cv    = @lock.new_cond
end

Public Instance Methods

await() click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_test.rb, line 579
def await
  @lock.synchronize { @cv.wait_while { @count > 0 } }
end
release() click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_test.rb, line 572
def release
  @lock.synchronize do
    @count -= 1 if @count > 0
    @cv.broadcast if @count == 0
  end
end