Run the event loop to receive messages from Nvim.

        While the event loop is running, `message_cb` will be called whenever
        a message has been successfully parsed from the input stream.
359906
def run(self, message_cb):
        
        self._message_cb = message_cb
        self.loop.run(self._on_data)
        self._message_cb = None
535081
def emit_event(self, event):
        """"""
        with self._lock:
            listeners = list(self._event_listeners)

        for cb in list(self._event_listeners):
            # noinspection PyBroadException
            try:
                cb(event)
            except:
                # Don't let exceptions from callbacks kill our thread of execution
                logger.exception("Event callback resulted in unhandled exception")
918081
def run(self):
        
        listener = EventServer(self.address, EventNotifyHandler)
        log.info("Event listener running on %s", listener.server_address)
        # Listen for events until told to stop
        while not self.stop_flag.is_set():
            listener.handle_request()
230439
def run
      @running = true

      connection.on_new_message do |message|
        @mailbox.deliver(message)
      end

      self.watching_thread = Thread.start do
        while(running?) do
          connection.wait
        end
      end

      watching_thread.abort_on_exception = true
    end
782304
def run_as_coroutine(self, stdin, callbacks):
        
        # Note: We cannot use "yield from", because this package also
        #       installs on Python 2.
        assert isinstance(callbacks, EventLoopCallbacks)

        if self.closed:
            raise Exception('Event loop already closed.')

        timeout = AsyncioTimeout(INPUT_TIMEOUT, callbacks.input_timeout, self.loop)
        self.running = True

        try:
            while self.running:
                timeout.reset()

                # Get keys
                try:
                    g = iter(self.loop.run_in_executor(None, self._console_input_reader.read))
                    while True:
                        yield next(g)
                except StopIteration as e:
                    keys = e.args[0]

                # Feed keys to input processor.
                for k in keys:
                    callbacks.feed_key(k)
        finally:
            timeout.stop()
231693
def process_messages_loop(self):
        
        self.receiving_messages = True
        try:
            self.process_messages_loop_internal()
        except pika.exceptions.ConnectionClosed as ex:
            logging.error("Connection closed {}.".format(ex))
            raise
1100355
@Override
    public void processMessage() {
        // this only picks up new training round
        //log.info("sI_{} Starting CBOW dot...", transport.getShardIndex());

        CbowRequestMessage cbrm = new CbowRequestMessage(rowsA, rowsB, w1, codes, negSamples, alpha, 119);
        if (negSamples > 0) {
            // unfortunately we have to get copy of negSamples here
            int negatives[] = Arrays.copyOfRange(rowsB, codes.length, rowsB.length);
            cbrm.setNegatives(negatives);
        }
        cbrm.setFrameId(-119L);
        cbrm.setTaskId(this.taskId);
        cbrm.setOriginatorId(this.getOriginatorId());


        // FIXME: get rid of THAT
        CbowTrainer cbt = (CbowTrainer) trainer;
        cbt.pickTraining(cbrm);


        // we calculate dot for all involved rows, and first of all we get mean word
        INDArray words = Nd4j.pullRows(storage.getArray(WordVectorStorage.SYN_0), 1, rowsA, 'c');
        INDArray mean = words.mean(0);

        int resultLength = codes.length + (negSamples > 0 ? (negSamples + 1) : 0);

        INDArray result = Nd4j.createUninitialized(resultLength, 1);
        int e = 0;
        for (; e < codes.length; e++) {
            double dot = Nd4j.getBlasWrapper().dot(mean, storage.getArray(WordVectorStorage.SYN_1).getRow(rowsB[e]));
            result.putScalar(e, dot);
        }

        // negSampling round
        for (; e < resultLength; e++) {
            double dot = Nd4j.getBlasWrapper().dot(mean,
                            storage.getArray(WordVectorStorage.SYN_1_NEGATIVE).getRow(rowsB[e]));
            result.putScalar(e, dot);
        }

        if (voidConfiguration.getExecutionMode() == ExecutionMode.AVERAGING) {
            DotAggregation dot = new DotAggregation(taskId, (short) 1, shardIndex, result);
            dot.setTargetId((short) -1);
            dot.setOriginatorId(getOriginatorId());
            transport.putMessage(dot);
        } else if (voidConfiguration.getExecutionMode() == ExecutionMode.SHARDED) {
            // send this message to everyone
            DotAggregation dot = new DotAggregation(taskId, (short) voidConfiguration.getNumberOfShards(), shardIndex,
                            result);
            dot.setTargetId((short) -1);
            dot.setOriginatorId(getOriginatorId());
            transport.sendMessage(dot);
        }
    }
1174468
def run(self):
        
        setproctitle.setproctitle("{:s}: {:s}".format(
            self.context.config.name, self.__class__.__name__))
        self.logger.info(
            "Worker '%s' has been started with pid %d",
            self.__class__.__name__, os.getpid())

        # Register SIGINT handler which will exit service process
        def sigint_handler(unused_signum, unused_frame):
            """
            Exit service process when SIGINT is reached.
            """
            self.stop()
        signal.signal(signal.SIGINT, sigint_handler)

        # Initialize logging
        self.context.config.configure_logging()
        # Initialize child
        self.context.initialize_child(SERVICE_PROCESS, process=self)

        next_loop_time = 0
        while 1:
            # Exit if pid of the parent process has changed (parent process
            # has exited and init is new parent) or if stop flag is set.
            if os.getppid() != self._parent_pid or self._stop_event.is_set():
                break
            # Repeatedly call loop method. After first call set ready flag.
            if time.time() >= next_loop_time:
                try:
                    self.loop()
                except Exception:
                    self.logger.exception(
                        "Worker '%s' failed", self.__class__.__name__)
                else:
                    if not next_loop_time and not self.ready:
                        self._ready.value = True
                next_loop_time = time.time() + self.interval
            else:
                time.sleep(0.25)
590581
def _event_loop(self):
        
        while True:
            orig_line = self.conn.iqueue.get()
            log.debug('<< ' + orig_line)
            line = u(orig_line, errors='replace').strip()
            err_msg = False
            try:
                message = Message(line)
            except ValueError:
                err_msg = True
            if err_msg or message.erroneous:
                log.error("Received a line that can't be parsed: \"%s\"" % orig_line)
                continue
            if message.command == ERR_NICKNAMEINUSE:
                self.set_nick(IRC.randomize_nick(self.nick))
            elif message.command == RPL_CONNECTED:
                for channel in self.channels:
                    self.join(channel)
            self._handle(message)
1169449
def run(self):
        
        while not self.stopEvent.isSet():
            try:
                # no need to monitor if no observers
                if 0 < self.observable.countObservers():
                    currentReaders = self.readerProc()
                    addedReaders = []
                    removedReaders = []

                    if currentReaders != self.readers:
                        for reader in currentReaders:
                            if reader not in self.readers:
                                addedReaders.append(reader)
                        for reader in self.readers:
                            if reader not in currentReaders:
                                removedReaders.append(reader)

                        if addedReaders or removedReaders:
                            # Notify observers
                            self.readers = []
                            for r in currentReaders:
                                self.readers.append(r)
                            self.observable.setChanged()
                            self.observable.notifyObservers((addedReaders,
                                                            removedReaders))

                # wait every second on stopEvent
                self.stopEvent.wait(self.period)

            except Exception:
                # FIXME Tighten the exceptions caught by this block
                traceback.print_exc()
                # Most likely raised during interpreter shutdown due
                # to unclean exit which failed to remove all observers.
                # To solve this, we set the stop event and pass the
                # exception to let the thread finish gracefully.
                self.stopEvent.set()
753296
def run(self):
        
        for line in self.incoming:
            message = loads(line)
            result = self._evaluate(message)
            if result is self._SKIP:
                continue
            self.output.write(dumps(result, cls=_DatetimeJSONEncoder) + b"\n")
861295
public void run() {
		byte[] buffer = new byte[80];
		byte[] message;
		int count = 0;

		while (!closed && count >= 0) {
			try {
				//statement blocks
				count = stdIn.read(buffer);
			}
			catch (IOException ioe) {
				close();
			}
			if (count > 0) {
				message = new byte[count];
				System.arraycopy(buffer, 0, message, 0, count);
				if (!closed) {
					transceiver.transmit(message);
				}
				else {
					try {
						stdOut.write(("dialog closed: unable to transmit '" + new String(message).trim() + "'...").getBytes());
					}
					catch (IOException ioe) {
						//...
					}
				}
			}
		}
	}
436211
def post_command_event(target, msg_cls, **kwargs):
    

    msg = msg_cls(id=-1, **kwargs)
    wx.PostEvent(target, msg)
1125984
async def emit(self, name):
        
        for cb in self._event_list[name]:
            if isawaitable(cb):
                await cb
            else:
                cb()
609390
def run_socket_event_loop(self):
        '''  '''
        try:
            while True:
                self._pool.join()

                # If we have no loggers we'll sleep briefly to ensure that we
                # allow other processes (I.e., the webserver) to do their work.
                if len(self._logger_data.keys()) == 0:
                    time.sleep(0.5)

        except KeyboardInterrupt:
            pass
        finally:
            self._pool.kill()
80087
def run(self):
        """"""
        try:
            while True:
                message = self.connection.recv()
                result = self.on_message(message)
                if result:
                    self.connection.send(result)
        except SelenolWebSocketClosedException as ex:
            self.on_closed(0, '')
            raise SelenolWebSocketClosedException() from ex
484230
def run(self):
        
        while True:
            msg = self._queue.get()
            if msg is _SHUTDOWN:
                break
            event, args, kwargs = msg
            self._logger('<< %s', event)
            for func in self._callbacks.get(event, []):
                func(*args, **kwargs)