Wait until the queue has something due, pop it off the queue, and return
 it.

 Returns the popped event.
961618
def pop
      @monitor.synchronize do
        if @events.empty?
          raise ThreadError, "queue empty" if @shutdown
          @resource.wait
        else
          delay = @events.first.at - Time.now
          @resource.wait(delay) if delay > 0
        end

        @events.shift
      end
    end
90579
async def wait(self, container = None):
        '''
        
        '''
        if hasattr(self, '_result'):
            if hasattr(self, '_exception'):
                raise self._exception
            else:
                return self._result
        else:
            ev = await FutureEvent.createMatcher(self)
            if hasattr(ev, 'exception'):
                raise ev.exception
            else:
                return ev.result
420040
def next(self):
        
        if self.blocking >= 0:
            # returns queue name and item, we just need item
            res = self.redis.blpop([self.name], timeout=self.blocking)
            if res:
                res = res[1]
        else:
            res = self.redis.lpop(self.name)
        value = self.deserialize(res)
        logger.debug('Popped from "%s": %s', self.name, repr(value))
        return value
1266242
def wait(self):
        
        ret = os.read(self.event_fd, 64 / 8)
        return struct.unpack('Q', ret)
837858
def wait_until_gone(self, timeout=0, *args, **selectors):
        
        return self.device(**selectors).wait.gone(timeout=timeout)
1228829
def wait_on(event)
      $shreduler.shredule(Shred.current, event, $shreduler.event_clock)
      Shred.current.pause
    end
46118
def wait(self, until=0):
        
        if self._count != until:
            self._waiters.setdefault(until, []).append(compat.getcurrent())
            scheduler.state.mainloop.switch()
199103
def wait_event(self, filter: Callable[[T_Event], bool] = None) -> Awaitable[T_Event]:
        """"""
        return wait_event([self], filter)
265473
def wait_for_event(event):
    
    f = Future()
    def ready():
        get_event_loop().remove_win32_handle(event)
        f.set_result(None)
    get_event_loop().add_win32_handle(event, ready)
    return f
357570
def wait_stop(self):
        
        if not self.running:
            return
        self.stop()
        try:
            yield from self._task
        except asyncio.CancelledError:
            pass
14213
def wait(self):
        
        self.wait_event = threading.Event()
        timeout = int(self.timeout) if self.timeout else None
        self.timed_out = not self.wait_event.wait(timeout)
459176
def PopEvent(self):
    
    try:
      _, _, _, event = heapq.heappop(self._heap)
      return event

    except IndexError:
      return None
360667
private Object waitingGet(boolean interruptible) {
    Signaller q = null;
    boolean queued = false;
    Object r;
    while ((r = result) == null) {
      if (q == null) {
        q = new Signaller(interruptible, 0L, 0L);
        if (Thread.currentThread() instanceof ForkJoinWorkerThread)
          ForkJoinPool.helpAsyncBlocker(defaultExecutor(), q);
      } else if (!queued)
        queued = tryPushStack(q);
      else {
        try {
          ForkJoinPool.managedBlock(q);
        } catch (InterruptedException ie) { // currently cannot happen
          q.interrupted = true;
        }
        if (q.interrupted && interruptible)
          break;
      }
    }
    if (q != null && queued) {
      q.thread = null;
      if (!interruptible && q.interrupted)
        Thread.currentThread().interrupt();
      if (r == null)
        cleanStack();
    }
    if (r != null || (r = result) != null)
      postComplete();
    return r;
  }
551444
public WaitQueue.Signal requestExtraSync()
    {
        WaitQueue.Signal signal = syncComplete.register();
        haveWork.release(1);
        return signal;
    }
305135
def popitem(self):
        """"""
        pq = self.pq
        while pq:
            priority, key, val = heapq.heappop(pq)
            if val is None:
                self.removed_count -= 1

            else:
                del self.item_finder[key]
                return key, val, priority

        raise KeyError("pop from an empty priority queue")
443138
def pop_event(self):
        """"""
        if len(self.event_list) > 0:
            evt = self.event_list.pop(0)
            return evt
        return None
351350
def pop(self):
        
        if len(self.stack):      
            popped = self.stack.pop()
            #log.debug('pop: (%s)\n%s', Repr(popped), Repr(self.stack))
            return popped
        else:
            #log.debug('stack empty, not-popped')
            pass
        return None