Waits until all queues of channels are empty.
162024
def wait_until_queue_empty(self, channels, report=True, clear_end=True):
        
        state = {'message': ''}

        self.logger.debug("wait_until_queue_empty: report=%s %s"
                          % (str(report), str([channel+':'+str(len(self.queues[channel])) for channel in channels]), ))
        queues = []
        for channel in channels:
            queues += self.queues[channel][:]

        def print_progress():
            if report:
                self.logger.debug("all_empty=%s" % (str(all_empty),))

                sys.__stderr__.write('\b' * len(state['message']))
                sys.__stderr__.write("\033[K")

                state['message'] = "%.2f kB/s // %.2fkB of %.2fkB // %.2f%%" \
                          % (self.bytes_speed / 1024, self.bytes_sent / 1024, self.bytes_total / 1024,
                            (self.bytes_sent / self.bytes_total * 100) if self.bytes_total else 0)

                sys.__stderr__.write(state['message'])
                sys.__stderr__.flush()

        while True:
            all_empty = all(m['_sent'] for m in queues)

            print_progress()

            if all_empty:
                break

            time.sleep(0.2)

        print_progress()

        if report and clear_end:
            sys.__stderr__.write('\b' * len(state['message']))
            sys.__stderr__.write("\033[K")
            sys.__stderr__.flush()
882053
public void waitAllThreadComplete(int waitInMillis) {
		for (int i=0; i<pool.length; i++) {
			if (pool[i] != null && pool[i].isAlive()) {
				try {
					pool[i].join(waitInMillis);
				} catch (InterruptedException e) {
				}
			}
		}
	}
1320946
void shutdownNow() {
    shutdown = true;
    for (int i = 0; i < channels.length; i++) {
      // Initiate channel shutdown
      channels[i].shutdown();
    }
    for (int i = 0; i < channels.length; i++) {
      try {
        // Wait for channel termination
        channels[i].awaitTermination(1, TimeUnit.SECONDS);
      } catch (InterruptedException ie) {
        channels[i].shutdownNow();
      }
    }
    fixedThreadPool.shutdownNow();
  }
548606
private void waitForChannelResubscription(final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap)
			throws BitfinexClientException, InterruptedException {
		
		final Stopwatch stopwatch = Stopwatch.createStarted();
		final long MAX_WAIT_TIME_IN_MS = TimeUnit.MINUTES.toMillis(3);
		logger.info("Waiting for streams to resubscribe (max wait time {} msec)", MAX_WAIT_TIME_IN_MS);

		synchronized (channelIdToHandlerMap) {
			
			while(channelIdToHandlerMap.size() != oldChannelIdSymbolMap.size()) {
				
				if(stopwatch.elapsed(TimeUnit.MILLISECONDS) > MAX_WAIT_TIME_IN_MS) {
					// Raise BitfinexClientException
					handleResubscribeFailed(oldChannelIdSymbolMap);
				}
				
				channelIdToHandlerMap.wait(500);
			}
			
		}
	}
401907
def wait_for_completion(self, interval=1):
        

        while not self.is_terminated(retry=True):
            try:
                time.sleep(interval)
            except KeyboardInterrupt:
                break
533379
public void waitUntilComplete() {
        lock.lock();
        try {
            while(processing || count.get() > 0) {
                try {
                    processing_done.await();
                }
                catch(InterruptedException ignored) {
                }
            }
        }
        finally {
            lock.unlock();
        }
    }
547134
def wait(self, timeout=None):
        
        import threading

        if self._state!=self.PENDING:
            return

        e = threading.Event()
        self.addCallback(lambda v: e.set())
        self.addErrback(lambda r: e.set())
        e.wait(timeout)
252173
def wait_until(predicate, timeout=30):
    
    not_expired = Timeout(timeout)
    while not_expired():
        r = predicate()
        if r:
            break
46118
def wait(self, until=0):
        
        if self._count != until:
            self._waiters.setdefault(until, []).append(compat.getcurrent())
            scheduler.state.mainloop.switch()
131645
def _wait(lfunc, log_lvl=None, log_msg=None, tries=10):
    '''
    
    '''
    i = 0
    while i < tries:
        time.sleep(1)

        if lfunc():
            return True
        else:
            i += 1
    if log_lvl is not None:
        log.log(LOG[log_lvl], log_msg)
    return False
520090
def wait(*args)
      pattern = args.pop
      unless pattern
        raise ArgumentError, 'Please provide condition to wait for'
      end

      run(*args) do |out, _|
        raise if out =~ /#{pattern}/
      end
    rescue ExitError
      # noop
    end
837858
def wait_until_gone(self, timeout=0, *args, **selectors):
        
        return self.device(**selectors).wait.gone(timeout=timeout)
149705
def _end_channel(self, channel):
        
        self.stop_on_empty_queue[channel] = True

        # by joining the we wait until its loop finishes.
        # it won't loop forever since we've set self.stop_on_empty_queue=True
        write_thread = self.thread_write_instances[channel]

        thread_join_non_blocking(write_thread)
720177
async def wait_message(self):
        """"""
        if not self._queue.empty():
            return True
        if self._queue.closed:
            return False
        await self._queue.wait()
        return self.is_active
1351417
def wait(self, interval=1, **kwargs):
        
        while True:
            status = self.info(**kwargs).get('status')
            if status == "ready":
                break
            if status != "training":
                raise IndicoError("Collection status failed with: {0}".format(status))
            time.sleep(interval)
109647
def _wait(self, args, now, cap, consumed_history, consumed_capacity):
        
        for key in ['read', 'write']:
            if key in cap and cap[key] > 0:
                consumed_history[key].add(now, consumed_capacity[key])
                consumed = consumed_history[key].value
                if consumed > 0 and consumed >= cap[key]:
                    seconds = math.ceil(float(consumed) / cap[key])
                    LOG.debug("Rate limited throughput exceeded. Sleeping "
                              "for %d seconds.", seconds)
                    if callable(self.callback):
                        callback_args = args + (seconds,)
                        if self.callback(*callback_args):
                            continue
                    time.sleep(seconds)
753107
def request_check_all(self, wait_time=5):
        """"""
        with self._lock:
            self._request_check_all()
            self._condition.wait(wait_time)