Gets the next event, blocking for it until available if requested.
@param wait true to block until next event is available, false to immediately return with null if there is no event.
@return the next event or null if there is currently none.
348131
public final ZEvent nextEvent(boolean wait)
    {
        if (!started) {
            System.out.println("ZMonitor: Start before getting events.");
            return null;
        }
        ZMsg msg = agent.recv(wait);
        if (msg == null) {
            return null;
        }
        return new ZEvent(msg);
    }
1174412
function getNext(event) {
        var cycleEvent,
            last = bench,
            async = isAsync(last);

        if (async) {
          last.off('complete', getNext);
          last.emit('complete');
        }
        // Emit "cycle" event.
        eventProps.type = 'cycle';
        eventProps.target = last;
        cycleEvent = Event(eventProps);
        options.onCycle.call(benches, cycleEvent);

        // Choose next benchmark if not exiting early.
        if (!cycleEvent.aborted && raiseIndex() !== false) {
          bench = queued ? benches[0] : result[index];
          if (isAsync(bench)) {
            delay(bench, execute);
          }
          else if (async) {
            // Resume execution if previously asynchronous but now synchronous.
            while (execute()) {}
          }
          else {
            // Continue synchronous execution.
            return true;
          }
        } else {
          // Emit "complete" event.
          eventProps.type = 'complete';
          options.onComplete.call(benches, Event(eventProps));
        }
        // When used as a listener `event.aborted = true` will cancel the rest of
        // the "complete" listeners because they were already called above and when
        // used as part of `getNext` the `return false` will exit the execution while-loop.
        if (event) {
          event.aborted = true;
        } else {
          return false;
        }
      }
867698
@Override
    public T drain() {
        T event = delayed.drain();
        if (event != null) {
            return event;
        }

        return source.drain();
    }
199103
def wait_event(self, filter: Callable[[T_Event], bool] = None) -> Awaitable[T_Event]:
        """"""
        return wait_event([self], filter)
516015
def get(self, timeout=None, block=True):
        
        return self.get_event(timeout, block).data
957194
@Override
    public T get() throws InterruptedException {
        try {
            get(0, null);
        } catch (TimeoutException e) {
            e.printStackTrace();
        }
        return t;
    }
1234137
@Override
  @SuppressWarnings("unchecked")
  public Task<ChangeEventT> nextEvent() throws IOException {
    return dispatcher.dispatchTask(new Callable<ChangeEventT>() {
      @Override
      public ChangeEventT call() throws Exception {
        final StitchEvent<ChangeEventT> nextEvent =
            (StitchEvent<ChangeEventT>) getInternalStream().nextEvent();

        if (nextEvent == null) {
          return null;
        }
        if (nextEvent.getError() != null) {
          dispatchError(nextEvent);
          return null;
        }
        if (nextEvent.getData() == null) {
          return null;
        }

        return nextEvent.getData();
      }
    });
  }
1267919
def get_events(self):
        '''
        
        '''
        ret = []
        while True:
            event = self.event.get_event(wait=1, full=True)
            if event is None:
                return ret
            ret.append(event)
765012
@Override
    public Object next() {
        Object retVal = null;
        try {
            retVal = nextEvent();
        } catch (final XMLStreamException e) {
            retVal = null;
        }
        return retVal;
    }
151165
public CallOptions withWaitForReady() {
    CallOptions newOptions = new CallOptions(this);
    newOptions.waitForReady = Boolean.TRUE;
    return newOptions;
  }
1215315
@Override
	public BufferOrEvent getNextNonBlocked() throws Exception {
		while (true) {
			// process buffered BufferOrEvents before grabbing new ones
			Optional<BufferOrEvent> next;
			if (currentBuffered == null) {
				next = inputGate.getNextBufferOrEvent();
			}
			else {
				next = Optional.ofNullable(currentBuffered.getNext());
				if (!next.isPresent()) {
					completeBufferedSequence();
					return getNextNonBlocked();
				}
			}

			if (!next.isPresent()) {
				if (!endOfStream) {
					// end of input stream. stream continues with the buffered data
					endOfStream = true;
					releaseBlocksAndResetBarriers();
					return getNextNonBlocked();
				}
				else {
					// final end of both input and buffered data
					return null;
				}
			}

			BufferOrEvent bufferOrEvent = next.get();
			if (isBlocked(bufferOrEvent.getChannelIndex())) {
				// if the channel is blocked, we just store the BufferOrEvent
				bufferBlocker.add(bufferOrEvent);
				checkSizeLimit();
			}
			else if (bufferOrEvent.isBuffer()) {
				return bufferOrEvent;
			}
			else if (bufferOrEvent.getEvent().getClass() == CheckpointBarrier.class) {
				if (!endOfStream) {
					// process barriers only if there is a chance of the checkpoint completing
					processBarrier((CheckpointBarrier) bufferOrEvent.getEvent(), bufferOrEvent.getChannelIndex());
				}
			}
			else if (bufferOrEvent.getEvent().getClass() == CancelCheckpointMarker.class) {
				processCancellationBarrier((CancelCheckpointMarker) bufferOrEvent.getEvent());
			}
			else {
				if (bufferOrEvent.getEvent().getClass() == EndOfPartitionEvent.class) {
					processEndOfPartition();
				}
				return bufferOrEvent;
			}
		}
	}
1303644
public static void runInEventDispatcherThread(Runnable runnable, Boolean wait) {

        Assert.notNull(runnable, "runnable");
        Assert.notNull(wait, "wait");

        if (EventQueue.isDispatchThread()) {
            runnable.run();
        } else if (wait) {
            try {
                EventQueue.invokeAndWait(runnable);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            } catch (InvocationTargetException e) {
                throw new RuntimeException(e);
            }
        } else {
            EventQueue.invokeLater(runnable);
        }
    }
1129801
def next_on(context, rrevent=None):
    
    request = context['request']
    if rrevent is None:
        rrevent = context.get('page')
    eventNextOn = getattr(rrevent, '_nextOn', lambda _:None)
    return eventNextOn(request)
1170159
public StitchEvent<T> nextEvent() throws IOException {
    final Event nextEvent = eventStream.nextEvent();
    if (nextEvent == null) {
      return null;
    }

    return StitchEvent.fromEvent(nextEvent, this.decoder);
  }
577192
public BlockingListMaker<K, E> waitFor(long time, TimeUnit unit) {
        this.nanoTimeout = time == 0 ? 1 : NANOSECONDS.convert(time, unit);
        return this;
    }
680859
def get_next(self, query, **options):
        """"""
        iterator = EventsPageIterator(self.client, '/events', query, options)
        result = iterator.next()
        return (result, iterator.sync)
1357962
public synchronized Object get() {
        Object o = null;

        while ((o = tryGet()) == null) {
            try {
                this.wait();
            } catch (final InterruptedException e) {
            }
        }
        return o;
    }