blocks until there is a connection
330390
public void checkConnection() {
        long start = Time.currentTimeMillis();

        while (clientChannel == null) {

            tcpSocketConsumer.checkNotShutdown();

            if (start + timeoutMs > Time.currentTimeMillis())
                try {
                    condition.await(1, TimeUnit.MILLISECONDS);

                } catch (InterruptedException e) {
                    throw new IORuntimeException("Interrupted");
                }
            else
                throw new IORuntimeException("Not connected to " + socketAddressSupplier);
        }

        if (clientChannel == null)
            throw new IORuntimeException("Not connected to " + socketAddressSupplier);
    }
1329224
def wait_for(scope, prompt):
    
    conn = scope.get('__connection__')
    conn.expect(prompt)
    scope.define(__response__=conn.response)
    return True
439003
def wait_for_up(self, timeout=40):
        

        self.wait_for_states(timeout, 'up')
        connectionStatus = self.get_attribute('connectionStatus').strip()
        if connectionStatus.split(':')[0] != self.get_attribute('assignedTo').split(':')[0]:
            raise TgnError('Failed to reach up state, port connection status is {} after {} seconds'.
                           format(connectionStatus, timeout))
424425
def lock(self, connection, session):
        
        cid = id(connection)
        try:
            self.connection_handle(connection).lock(session)
        except KeyError:
            raise ConnectionNotFoundError(self.id, cid)
        else:
            if self.idle_start:
                with self._lock:
                    self.idle_start = None
        LOGGER.debug('Pool %s locked connection %s', self.id, cid)
745917
def _blocked_connection(self, frame_in):
        
        self.is_blocked = True
        LOGGER.warning(
            'Connection is blocked by remote server: %s',
            try_utf8_decode(frame_in.reason)
        )
570605
public void waitUntilConnectionReleasedIfNecessary() throws InterruptedException {
        if (ConnectionStatus.RUNNING == status.get() || ConnectionStatus.TERMINATED == status.get()) {
            while (!status.compareAndSet(ConnectionStatus.RELEASE, ConnectionStatus.RUNNING)) {
                resourceSynchronizer.doAwaitUntil();
            }
        }
    }
1119306
def yield_connections(sock):
    """"""
    while True:
        log.debug('waiting for connection on %s', sock.getsockname())
        try:
            conn, _ = sock.accept()
        except KeyboardInterrupt:
            return
        conn.settimeout(None)
        log.debug('accepted connection on %s', sock.getsockname())
        yield conn
288671
def _disconnect_locked(self):
    """"""
    self._connected = False
    self._connect_cond.notify_all()
    self._telnet = None
    _LOGGER.warning("Disconnected")
124923
public void blockTillTerminated() {
    while (!runState.compareAndSet(State.IDLE, State.REMOVED)) {
      // wait and retry
      LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10));
      if (Thread.currentThread().isInterrupted()) {
        runState.set(State.REMOVED);
        return;
      }
    }
  }
1245306
private void blockIfNecessary() {
        if (diskPermits == null || diskLimit == Long.MAX_VALUE)
            return;
        try {
            diskPermits.acquire();
        } catch (InterruptedException e) {
            // don't want to re-interrupt so it won't cause SDK stream to be
            // closed in case the thread is reused for a different request
            throw new AbortedException(e);
        }
    }
1053448
def create_blocking_connection(host):
    
    return pika.BlockingConnection(
        amqpdaemon.getConParams(
            settings.get_amqp_settings()[host.lower()]["vhost"]
        )
    )
1213811
def wait_while(timeout = 30, &block)
      returned = nil

      Timeout.timeout(timeout) do
        while returned = yield(self)
          refresh_page_from_window
          sleep 0.1
        end
      end

      returned
    end
1201034
public static void wait(Object lock, long timeout) {
	try {
	    synchronized (lock) {
		lock.wait(timeout);
	    }
	}
	catch (InterruptedException e) {}
    }
252173
def wait_until(predicate, timeout=30):
    
    not_expired = Timeout(timeout)
    while not_expired():
        r = predicate()
        if r:
            break
733171
public void onConnect() {
        input.setDisabled(false);
        sendingButton.setDisabled(false);
        connectingButton.setDisabled(true);
        disconnectingButton.setDisabled(false);
    }
1022641
def wait_until_connected(timeout=10)
    time_to_stop = timeout ? Time.now + timeout : nil

    return false unless wait_until_running(timeout)

    @state_mutex.synchronize do
      while true 
        if timeout
          now = Time.now
          break if (@state == ZOO_CONNECTED_STATE) || unhealthy? || (now > time_to_stop)
          delay = time_to_stop.to_f - now.to_f
          @state_cond.wait(delay)
        else
          break if (@state == ZOO_CONNECTED_STATE) || unhealthy?
          @state_cond.wait
        end
      end
    end

    connected?
  end
1095716
async def block_until(*conditions, timeout=None, wait_period=0.5, loop=None):
    
    async def _block():
        while not all(c() for c in conditions):
            await asyncio.sleep(wait_period, loop=loop)
    await asyncio.wait_for(_block(), timeout, loop=loop)