Synchronously wait until this work item is processed.

        This has the effect of waiting until all work items queued before this
        method has been called have finished.
487885
def flush(self):
        

        done = threading.Event()

        def _callback():
            done.set()

        self.defer(_callback)
        done.wait()
309540
protected final void waitForDeliverySync()
    {
    	List<AbstractSession> sessionsSnapshot = new ArrayList<>(sessions.size());
        synchronized (sessions)
        {
        	sessionsSnapshot.addAll(sessions.values());
        }
        for(int n=0;n<sessionsSnapshot.size();n++)
        {
            AbstractSession session = sessionsSnapshot.get(n);
            session.waitForDeliverySync();
        }
    }
670334
public final synchronized void waitFor() {
        if (this.thread == null)
            return;

        synchronized (this.thread) {
            if (this.thread == null)
                return;

            try {
                this.thread.wait();
            } catch (InterruptedException e) {
                // Wir sind raus.
            }
        }
    }
607334
@Override
    public void waitForFinish() throws IOException
    {
        if (future == null)
        {
            throw new IllegalStateException("not started");
        }
        try
        {
            future.get();
        }
        catch (InterruptedException | ExecutionException ex)
        {
            throw new IOException(ex);
        }
    }
1086893
public void waitUntilFinished()
    {
        flushTermination();
        flushUpdate();
        flushInsert();
        shutdown();
        for (int i = 0; i < numberOfUpdateThreads; i++)
        {
            while(!executor[i].isTerminated())
            {
                try
                {
                    executor[i].awaitTermination(10000000, TimeUnit.SECONDS);
                }
                catch (InterruptedException e)
                {
                    // ignore
                }
            }
        }
        flushInsert();
        insertExecutor.shutdown();
        while(!insertExecutor.isTerminated())
        {
            try
            {
                insertExecutor.awaitTermination(10000000, TimeUnit.SECONDS);
            }
            catch (InterruptedException e)
            {
                // ignore
            }
        }
        logFinalResults();
        if (this.error != null)
        {
            if (error instanceof RuntimeException)
            {
                throw (RuntimeException) error;
            }
            else
            {
                throw new RuntimeException("One or more parallel tasks failed", this.error);
            }
        }
    }
1226344
public synchronized boolean waitForFinish() throws Throwable {
    while (!done && exception == null) {
      wait();
    }
    if (exception != null) {
      throw exception;
    }
    return done;
  }
516940
private void await() {
    try {
      // Clean up all filter join leaf nodes that have been converted
      boolean nodeRemoved = this.removeConvertedNodes(root);
      // If some nodes were removed, it means that we converted in the previous iteration
      // at least one filter join into a field data terms query. We don't have to wait since
      // we might have new filter join leaf nodes.
      if (!nodeRemoved && root.hasChildren()) {
        logger.debug("Visitor thread block - blocking queue size: {}", blockingQueue.size());
        this.blockingQueue.take();   // block until one async action is completed
        this.blockingQueue.offer(0); // add back the element to the queue, it will be removed after the node conversion
        logger.debug("Visitor thread unblock - blocking queue size: {}", blockingQueue.size());
      }
    }
    catch (InterruptedException e) {
      logger.warn("Filter join visitor thread interrupted while waiting");
      Thread.currentThread().interrupt();
    }
  }
1164076
public void waitUntilComplete(long timeout) {
        long base=System.currentTimeMillis();
        long now=0;
        lock.lock();
        try {
            while(processing || count.get() > 0) {
                long delay=timeout-now;
                if(delay <= 0)
                    break;
                try {
                    processing_done.await(delay, TimeUnit.MILLISECONDS);
                    now=System.currentTimeMillis()-base;
                }
                catch(InterruptedException e) {
                }
            }
        }
        finally {
            lock.unlock();
        }
    }
1240223
public void waitUntilWorkDone(){
		while(objectListSize()>0 || getRunningThreadNumber()>0){
			if (stopped){
				log.fatal("El pool se ha parado de forma anormal. List Size:"+objectListSize()+" running threads:"+getRunningThreadNumber()+"/"+getThreadPoolSize());
				return ;
			}
			if (log.isDebugEnabled()){
				log.debug("List Size:"+objectListSize()+" running threads:"+getRunningThreadNumber()+"/"+getThreadPoolSize());
			}
			try {
				log.info("STILL WAITING List Size:"+objectListSize()+" running threads:"+getRunningThreadNumber()+"/"+getThreadPoolSize());

				Thread.sleep(1000);
			} catch (InterruptedException e) {
			}
		}

		log.info(" Calling threadWorkDone.");

		for (InnerConsumerThread thread:threadList) {
			try {
				// update the work done flag and notify thre thread
				thread.threadWorkDone();
				synchronized (thread) {
					thread.notify();
				}
			}catch(Throwable e){
				log.error("Error in threadWorkDone for thread:"+thread.getName(),e);
			}
		}
		
		synchronized (objectList) {
			objectList.notifyAll();		
		}

		if (log.isInfoEnabled()){
			log.info("Work, done. List Size:"+objectListSize()+" running threads:"+getRunningThreadNumber()+"/"+getThreadPoolSize());
		}
		
		log.info("FINISH: Work, done. List Size:"+objectListSize()+" running threads:"+getRunningThreadNumber()+"/"+getThreadPoolSize());

	}
1138283
def wait_process(self):
        """"""
        self.process.wait()
        if self.analyze_data:
            self.receiving_thread.join()
46118
def wait(self, until=0):
        
        if self._count != until:
            self._waiters.setdefault(until, []).append(compat.getcurrent())
            scheduler.state.mainloop.switch()
230270
public void waitForChecked(final long time) throws WidgetException {
        super.waitForCommand(new ITimerCallback() {

            @Override
            public boolean execute() {
                WebElement elem = null;
                try {
                    elem = getWebElement();
                } catch (WidgetException e) {

                }

                boolean isSelected = false;
                try {
                    isSelected = isSelected(elem);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
                return (elem != null && isSelected);
            }

            @Override
            public String toString() {
                return "Waiting for element with the locator: " + getByLocator() + "to be checked";
            }
        }, time);
    }
145859
public void waitUntilFinish() {
        while (!finished) {
            synchronized (waitingLock) {
                if (config.isHaltOnError()) {
                    Throwable t = getError();
                    if (t != null && config.isHaltOnError()) {
                        if (t instanceof RuntimeException) {
                            throw (RuntimeException)t;
                        } else if (t instanceof Error) {
                            throw (Error)t;
                        } else {
                            throw new RuntimeException("error on monitor thread", t);
                        }
                    }
                }
                if (finished) {
                    return;
                }
                try {
                    waitingLock.wait();
                } catch (InterruptedException e) {
                    logger.error("Error occurred", e);
                }
            }
        }
    }
971623
private void waitFor( long millis )
    {
        Object lock = new Object();
        synchronized ( lock )
        {
            try
            {
                lock.wait( millis );
            }
            catch ( InterruptedException e )
            {
                Thread.currentThread().interrupt(); // good practice if don't throw
                getLog().warn( "Spuriously interrupted while waiting for " + millis + "ms", e );
            }
        }
    }
464990
private void waitForAsyncSendCompletion() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "waitForAsyncSendCompletion");

        while (!(_asyncSendQueue.isEmpty() && (currentAsyncSendObject == null))) {
            try {
                synchronized (_asyncSendQueue) {
                    // after twenty second.. again check is made if the async send queue is empty.
                    //the sleep time is precautinary measure.. to avoid a futuristic scenario in which notification would not come.
                    _asyncSendQueue.wait(1000 * 20);
                }
            } catch (InterruptedException e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc, "waitForAsyncSendCompletion got interrupted", e);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "waitForAsyncSendCompletion");
    }
271315
public void waitForCloseToComplete()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "waitForCloseToComplete");

      closeWaitersMonitor.waitOn();

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "waitForCloseToComplete");
   }
65558
public static void waitOneFinished(List<? extends Task<?,?>> tasks) {
		if (tasks.isEmpty()) return;
		if (tasks.size() == 1)
			try { tasks.get(0).getOutput().block(0); }
			catch (Throwable e) { /* ignore */ }
		SynchronizationPoint<Exception> sp = new SynchronizationPoint<>();
		for (Task<?,?> t : tasks) {
			if (t.isDone()) return;
			t.getOutput().synchWithNoError(sp);
		}
		sp.block(0);
	}