Process all callbacks, until `stop()` is called. Intended to run in
        its own thread.
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)
702468
function() {
		var i = 0;
		while (i<_callbacks.length) {
			var deps = _callbacks[i][0],
				func = _callbacks[i][1],
				n = 0;
			while (n<deps.length) {
				if (areDeepDepsDefined(deps[n])) {
					deps.splice(n, 1);
				}
				else {
					n++;
				}
			}
			if (!deps.length) {
				_callbacks.splice(i, 1);
				if (func != null) {
					setTimeout(func, 0);
				}
			}
			else {
				i++;
			}
		}
	}
995512
def stop(self, timeout=None):
        

        self.stopping = True

        for process in list(self.processes):
            self.stop_process(process, timeout=timeout)
1365592
def finalize_processes(self):
        # type: (_MultiprocessOffload) -> None
        
        self._term_signal.value = 1
        if self._check_thread is not None:
            self._check_thread.join()
        for proc in self._procs:
            proc.join()
1173230
@Override
  public void run() {
    synchronized (lock) {
      if (!callables.hasNext()) {
        checkEnd();
        return;
      }

      for (int i = 0; i < parallelism && callables.hasNext(); i++) {
        setupNext(callables.next());
      }
    }

    future.whenCancelled(() -> {
      cancel = true;
      checkNext();
    });
  }
630858
def run(self):
        
        self._initialize()

        self._do_collect()
        while not self._is_finished:
            time.sleep(self._reload_interval)
            self._do_collect()

        self.logger.info("Collector stopped.")
405221
def process_events
      until @dead
        @mutex.synchronize do
          while @queue.empty?
            break if @dead
            @not_empty.wait(@mutex)
          end
          event = @queue.pop
          break unless event
          notify_listeners(event)
          event.dispatch
        end
      end
    rescue Exception => ex
      Logger.error "Error while running event: #{Logger.format_error(ex)}"
    end
1239616
async def wait_for_all_to_process(self, *matchers, eventlist = None, eventdict = None,
                                            callback = None):
        
        def _callback(event, matcher):
            event.canignore = True
            if callback:
                callback(event, matcher)
        return await self.wait_for_all(*matchers, eventlist=eventlist,
                                       eventdict=eventdict, callback=_callback)
277716
def run(self):
    """"""
    while not self._state.is_terminating:
      self._process_event_queue()
      self._state.maybe_pause()
1362964
def _do_callbacks(self):
        """"""
        self._done = False

        while self._callbacks and not self._cancelled:
            cb, eb, cb_args, cb_kwargs, eb_args, eb_kwargs = self._callbacks.pop()
            if cb and not self._exception:
                try:
                    self._result = cb(self._result, *cb_args, **cb_kwargs)
                    self._exception = False
                except Exception as e:
                    #logger.exception('deferred got exception while doing callback')
                    self._exception = True
                    self._result = e
                    self._tb_info = ''.join(traceback.format_tb(sys.exc_info()[2]))
            elif eb and self._exception:
                try:
                    self._result = eb(self._result, *eb_args, **eb_kwargs)
                    self._exception = False
                except Exception as e:
                    #logger.exception('deferred got exception while doing callback')
                    self._exception = True
                    self._result = e
                    self._tb_info = ''.join(traceback.format_tb(sys.exc_info()[2]))


        if self._exception:
            if Deferred.warnings:
                logger.warn('Unhandled Exception: ' + str(self._result))
            self._last_exception.exception = self._result
            self._last_exception.tb_info = self._tb_info
        else:
            self._last_exception.exception = None
            self._last_exception.tb_info = None

        self._done = True
852192
public void process() {
    // are we ready to process yet, or have we had an error, and are
    // waiting a bit longer in the hope that it will resolve itself?
    if (error_skips > 0) {
      error_skips--;
      return;
    }
    
    try {
      if (logger != null)
        logger.debug("Starting processing");
      status = "Processing";
      lastCheck = System.currentTimeMillis();

      // FIXME: how to break off processing if we don't want to keep going?
      processor.deduplicate(batch_size);

      status = "Sleeping";
      if (logger != null)
        logger.debug("Finished processing");
    } catch (Throwable e) {
      status = "Thread blocked on error: " + e;
      if (logger != null)
        logger.error("Error in processing; waiting", e);
      error_skips = error_factor;
    }
  }
1035896
function done(err) {
            if (err != null) {
                process.exitCode = 1
                console.error(`  ERROR: ${err.message}`)
            }
            if (options.verbose && err == null) {
                console.log("  Done.")
            }

            next()

            if (callback != null) {
                callback(err)
            }
        }
1112158
public void run() {
        try {
            callback.open();
            this.request = getLogRequest(true);
            final HttpResponse response = client.execute(request);
            parseResponse(response);
        } catch (LogCallback.DoneException e) {
            // Signifies we're finished with the log stream.
        } catch (IOException e) {
            callback.error("IO Error while requesting logs: " + e + " " + Thread.currentThread().getName());
        } finally {
            callback.close();
        }
    }
1203280
def run(self):
        """"""
        self.running = True
        while self.running:
            for fd, event in self.epoll.poll(self.epoll_timeout):
                callback = self.callbacks.get(fd)
                if callback:
                    callback()
12571
function(callback) {
			this.factory.running = false;
			this._clearInterval(callback);
			this.callback(this.callbacks.stop);
			this.callback(callback);
		}
520100
public function run()
    {
        $this->addPending();
        $this->ran = true;

        while (count($this->inProcess) !== 0) {

            $this->monitorPending();
        }

        // Clear the references for callbacks.
        $this->onSuccess = null;
        $this->onError = null;
    }
266351
def _finish(self):
        
        if self._process.returncode is None:
            self._process.stdin.flush()
            self._process.stdin.close()
            self._process.wait()
            self.closed = True