class Concurrent::Synchronization::AbstractLockableObject

def ns_wait_until(timeout = nil, &condition)

Other tags:
    Note: - to provide direct access to this method in a descendant add method
    Note: - only to be used inside synchronized block

Returns:
  • (true, false) - if condition met

Other tags:
    Yieldreturn: -

Other tags:
    Yield: - condition to be met

Parameters:
  • timeout (Numeric, nil) -- in seconds, `nil` means no timeout
def ns_wait_until(timeout = nil, &condition)
  if timeout
    wait_until = Concurrent.monotonic_time + timeout
    loop do
      now              = Concurrent.monotonic_time
      condition_result = condition.call
      return condition_result if now >= wait_until || condition_result
      ns_wait wait_until - now
    end
  else
    ns_wait timeout until condition.call
    true
  end
end