class Concurrent::MVar

def borrow(timeout = nil)

Returns:
  • (Object) - the value returned by the block, or `TIMEOUT`
def borrow(timeout = nil)
  @mutex.synchronize do
    wait_for_full(timeout)
    # if we timeoud out we'll still be empty
    if unlocked_full?
      yield @value
    else
      TIMEOUT
    end
  end
end