If threads is empty we wait on condition for DEFAULT_TEMPORISATION millis to be notified,
otherwise we wait for 1s
549572
public void waitThreadStopped() { // FIXME: method named in confusing way
        long sleepTime = threads.isEmpty() ? DEFAULT_TEMPORISATION : MIN_CHECK_TIME;
        lock.lock();
        try {
             condition.await(sleepTime, TimeUnit.MILLISECONDS); // NOSONAR 
        } catch (InterruptedException e) {
            log.debug("Interrupted", e);
            Thread.currentThread().interrupt();
        } finally {
            lock.unlock();
        }
    }
947108
def wait_until_done(self, timeout=None):
        """"""
        start = datetime.now()
        if not self.__th:
            raise IndraDBRestResponseError("There is no thread waiting to "
                                           "complete.")
        self.__th.join(timeout)
        now = datetime.now()
        dt = now - start
        if self.__th.is_alive():
            logger.warning("Timed out after %0.3f seconds waiting for "
                           "statement load to complete." % dt.total_seconds())
            ret = False
        else:
            logger.info("Waited %0.3f seconds for statements to finish loading."
                        % dt.total_seconds())
            ret = True
        return ret
291821
def wait(self):
        
        self.thread.join()
        if self.error is not None:
            return self.error
        return self.result
389049
def thread_timeout=(t)
      t = t.to_f
      raise ArgumentError.new('Value must be greater than zero or nil') unless t >= 0
      @thread_timeout = t
      @threads.each{|thread|thread.thread_timeout = t}
      t
    end
622458
def sync(self, expectedThreads=0):
        ''
        while len(self.unfinishedThreads) > expectedThreads:
            time.sleep(.3)
            self.checkForFinishedThreads()
815971
public void checkAllThreads() {

        // if nothing is plugged in, exit early
        if (this.monitorPlugin == null) {
            return;
        }

        long currentTime = 0; // lazily initialize current time

        try {
            for (Iterator i = this.threads_.values().iterator(); i.hasNext();) {

                Worker thread = (Worker) i.next();
                synchronized (thread) { // d204471
                    if (thread.getStartTime() > 0) {
                        if (currentTime == 0) {
                            currentTime = System.currentTimeMillis();
                        }

                        if (!thread.isHung && this.monitorPlugin.checkThread(thread, thread.threadNumber, currentTime - thread.getStartTime())) { // PK25446
                            thread.isHung = true;
                        }
                    }
                }
            }

            this.lastThreadCheckDidntComplete = false; // D222794
        } catch (ConcurrentModificationException e) { // begin D222794
            // NOTE: we can pretty much ignore this exception ... if
            // we occasionally fail on the check, we'll be OK. So
            // we simply keep track with a flag. If two consecutive
            // checks fail, then we'll log to FFDC
            if (this.lastThreadCheckDidntComplete) {
                // Alex Ffdc.log(e, this, this.getClass().getName(), "1181", this); //
                // D477704.2
            }
            this.lastThreadCheckDidntComplete = true;
        } // end D222794
    }
1219728
public static long waitTillNextMillisec(long currentMillisec) {
        long nextMillisec = System.currentTimeMillis();
        for (; nextMillisec <= currentMillisec; nextMillisec = System.currentTimeMillis()) {
            Thread.yield();
        }
        return nextMillisec;
    }
266476
def thread_started(self):
		
		while self.check_events() is False:
			self._polling_iteration()
			self.stop_event().wait(self.polling_timeout())
642512
def wait(self):
        """"""
        now = _monotonic()
        if now < self._ref:
            delay = max(0, self._ref - now)
            self.sleep_func(delay)
        self._update_ref()
1131333
def _wait_for_disk_threads(self, terminate):
        # type: (Uploader, bool) -> None
        
        if terminate:
            self._upload_terminate = terminate
        for thr in self._disk_threads:
            thr.join()
922718
def wait(self, timeout=None):
        
        try:
            if timeout:
                gevent.sleep(timeout)
            else:
                while True:
                    gevent.sleep(1000)
        except (KeyboardInterrupt, SystemExit, Exception):
            pass
847965
private boolean waitForWebElementsToBeCreated(){
		final long endTime = SystemClock.uptimeMillis() + 5000;

		while(SystemClock.uptimeMillis() < endTime){

			if(isFinished){
				return true;
			}

			sleeper.sleepMini();
		}
		return false;
	}
68310
def wait_until_exit(self):
        
        [t.join() for t in self.threads]

        self.threads = list()
1159295
public static boolean sleep(Number millis) {
		if (millis == null) {
			return true;
		}

		try {
			Thread.sleep(millis.longValue());
		} catch (InterruptedException e) {
			return false;
		}
		return true;
	}
764109
public static void pause(long milli) {
		final Thread t = Thread.currentThread();
		long start = System.currentTimeMillis();
		while( System.currentTimeMillis() - start < milli ) {
			synchronized( t )  {
				try {
					long target = milli - (System.currentTimeMillis() - start);
					if( target > 0 )
						t.wait(target);
				} catch (InterruptedException ignore) {
				}
			}
		}
	}
619142
public void waitForAllActivitiesDestroy(int timeOutInMillis) {
        synchronized (activityStack) {
            long start = System.currentTimeMillis();
            long now = start;
            while (!activityStack.isEmpty() && start + timeOutInMillis > now) {
                try {
                    activityStack.wait(start - now + timeOutInMillis);
                } catch (InterruptedException ignored) {
                }
                now = System.currentTimeMillis();
            }
        }
    }
1184239
public void threadStarted(ThreadPool tp, int activeThreads, int maxThreads)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "threadStarted", new Object[]{tp, new Integer(activeThreads), new Integer(maxThreads)});
    
    if (TraceComponent.isAnyTracingEnabled() && (tc.isDebugEnabled() || tc.isDumpEnabled() || tc.isEntryEnabled() || tc.isEventEnabled()))
      SibTr.push(_messageProcessor.getMessagingEngine());  
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "threadStarted");
  }