Wake ``n`` waiters.
554454
def notify(self, n: int = 1) -> None:
        """"""
        waiters = []  # Waiters we plan to run right now.
        while n and self._waiters:
            waiter = self._waiters.popleft()
            if not waiter.done():  # Might have timed out.
                n -= 1
                waiters.append(waiter)

        for waiter in waiters:
            future_set_result_unless_cancelled(waiter, True)
505327
private synchronized static void acquireWakeLock(Context context) {
        // Setup wake lock.
        if (sWakeLock == null) {
            PowerManager powerManager = (PowerManager) context.getApplicationContext().getSystemService(
                    Context.POWER_SERVICE);
            sWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, NAME);
            sWakeLock.setReferenceCounted(true);
        }

        // Acquire lock.
        sWakeLock.acquire();

        sLogger.log(WingsService.class, "acquireWakeLock", "sWakeLock=" + sWakeLock);
    }
274791
function enqueue(fn) {
  window._vis_opt_queue = window._vis_opt_queue || [];
  window._vis_opt_queue.push(fn);
}
569435
def interrupt (aggregate):
    """"""
    while True:
        try:
            log.warn(LOG_CHECK,
               _("interrupt; waiting for active threads to finish"))
            log.warn(LOG_CHECK,
               _("another interrupt will exit immediately"))
            abort(aggregate)
            break
        except KeyboardInterrupt:
            pass
861859
def iterqueue(queue, expected):
    """"""
    while expected > 0:
        for item in iter(queue.get, EXIT):
            yield item
        expected -= 1
224890
static void sleep(long n) {
    try {
      Thread.sleep(n);
    } catch (InterruptedException e) {
      LOG.warn("Thread interrupted", e);
      Thread.currentThread().interrupt();
    }
  }
689914
def throttle(self, key, amount=1, rate=None, capacity=None,
            exc_class=Throttled, **kwargs):
        """"""

        if not self.consume(key, amount, rate, capacity, **kwargs):
            raise exc_class("Request of %d unit for %s exceeds capacity."
                    % (amount, key))
1237252
def get(self, loop=None):
        """"""
        self._clear_done_waiters()
        if not self._waiters:
            # If something is available directly, we can avoid going back to
            # the scheduler
            try:
                heap = self.get_nowait()
            except spead2.Empty:
                pass
            else:
                # Give the event loop a chance to run. This ensures that a
                # heap-processing loop cannot live-lock the event loop.
                yield
                raise Return(heap)

        if loop is None:
            loop = self._loop
        waiter = trollius.Future(loop=loop)
        self._waiters.append(waiter)
        self._start_listening()
        heap = (yield From(waiter)).pop()
        raise Return(heap)
441251
def wait(self, till=None):
        
        waiter = Signal()
        if self.waiting:
            DEBUG and _Log.note("waiting with {{num}} others on {{name|quote}}", num=len(self.waiting), name=self.name, stack_depth=1)
            self.waiting.insert(0, waiter)
        else:
            DEBUG and _Log.note("waiting by self on {{name|quote}}", name=self.name)
            self.waiting = [waiter]

        try:
            self.lock.release()
            DEBUG and _Log.note("out of lock {{name|quote}}", name=self.name)
            (waiter | till).wait()
            if DEBUG:
                _Log.note("done minimum wait (for signal {{till|quote}})", till=till.name if till else "", name=self.name)
        except Exception as e:
            if not _Log:
                _late_import()
            _Log.warning("problem", cause=e)
        finally:
            self.lock.acquire()
            DEBUG and _Log.note("re-acquired lock {{name|quote}}", name=self.name)

        try:
            self.waiting.remove(waiter)
            DEBUG and _Log.note("removed own signal from {{name|quote}}", name=self.name)
        except Exception:
            pass

        return bool(waiter)
819015
def process(self, sched, coro):
        """"""
        super(Join, self).process(sched, coro)
        self.coro.add_waiter(coro)
1173998
private void doInterruptAllWaitingThreads() {
    	//Interrupt all the threads
    	for (int i=0; i<nThreads; i++) {
    		threads[i].interrupt();
    	}
    	
    	synchronized(lock) {
    		lock.notify();
    	}
    }
624248
def clean(self, force: bool=False):
        '''
        '''
        assert not self._closed

        with (yield from self._host_pools_lock):
            for key, pool in tuple(self._host_pools.items()):
                yield from pool.clean(force=force)

                if not self._host_pool_waiters[key] and pool.empty():
                    del self._host_pools[key]
                    del self._host_pool_waiters[key]
1141541
public function wakeup()
    {
        if ($this->state === Generic::STATE_WAITING) {
            $this->ev->del();
            $this->ev->add(0);
        }
    }
91903
function Queue(concurrency) {
  this.paused = false;
  this.concurrency = concurrency;
  this.waitTimeout = 0;
  this.processTimeout = 0;
  this.throttleCount = 0;
  this.throttleInterval = 1000;
  this.count = 0;
  this.tasks = [];
  this.waiting = [];
  this.factors = {};
  this.fifoMode = true;
  this.roundRobinMode = false;
  this.priorityMode = false;
  this.onProcess = null;
  this.onDone = null;
  this.onSuccess = null;
  this.onTimeout = null;
  this.onFailure = null;
  this.onDrain = null;
}
312328
def later(timeout, f, *args, **kwargs):
    '''
    
    '''
    def wrap(*args, **kwargs):
        sleep(timeout)
        return f(*args, **kwargs)

    return spawn(wrap, *args, **kwargs)
1258642
def close(self) -> None:
        """"""
        self._close = True
        if self._waiter:
            self._waiter.cancel()
1222364
def wait_for_term():
    

    class Waiter:

        def __init__(self):
            self.sleeping = True
            import signal #@Reimport
            self.oldhandler = signal.signal(signal.SIGTERM,
                                            self._SIGTERMHandler)

        def _SIGTERMHandler(self, number, frame):
            self.sleeping = False

        def sleep(self):
            while self.sleeping:
                time.sleep(0.1)

    waiter = Waiter()
    waiter.sleep()