Process from queue until it is empty.
170703
def run(self):
        """"""
        try:
            while not self.stopped:
                scraperobj = jobs.get(False)
                self.setName(scraperobj.getName())
                try:
                    self.getStrips(scraperobj)
                finally:
                    jobs.task_done()
                    self.setName(self.origname)
        except Empty:
            pass
        except KeyboardInterrupt:
            thread.interrupt_main()
1205208
def process_task(self):
        """"""
        if _debug: ServerSSM._debug("process_task")

        if self.state == SEGMENTED_REQUEST:
            self.segmented_request_timeout()
        elif self.state == AWAIT_RESPONSE:
            self.await_response_timeout()
        elif self.state == SEGMENTED_RESPONSE:
            self.segmented_response_timeout()
        elif self.state == COMPLETED:
            pass
        elif self.state == ABORTED:
            pass
        else:
            if _debug: ServerSSM._debug("invalid state")
            raise RuntimeError("invalid state")
876638
function runQueue() {
    // Flag whether locker is busy (i.e. has current or pending processes)
    this.busy = (this.running || this.queue.length);

    // Run all items in queue until item requiring exclusive lock
    while (true) {
        var again = runNext.call(this);
		if (!again) return;
    }
}
1207073
function processQueue(){
      try {
        // mark queue as processing to avoid concurrency
        processing = true;

        // process queue
        var item;
        while (item = queue.shift())
          item.fn.call(item.context);
      } finally {
        // queue is not processing anymore
        processing = false;

        // if any function in queue than exception was occured,
        // run rest functions in next code frame
        if (queue.length)
          timer = setImmediate(process);
      }
    }
389260
def create_queue(self):
        """"""
        q = asyncio.Queue()
        q.Empty = asyncio.QueueEmpty
        return q
1130809
def flush(self, ignore_priority=False):
        
        for process_name, q in self.reprocess_uows.items():
            self._flush_queue(q, ignore_priority)
886996
function processQueue(queue, value) {
            if (!queue || queue.length === 0) return;
            var handler, i = 0;

            while (handler = queue[i++]) {
                handler(value);
            }
        }
1160395
def terminate(self, wait=False):
        """"""
        if self.proc is not None:
            self.proc.stdout.close()
            try:
                self.proc.terminate()
            except ProcessLookupError:
                pass
            if wait:
                self.proc.wait()
1150356
def process(self, blob):
        """"""
        # self._add_process_dt()
        try:
            log.debug("Waiting for queue items.")
            prefix, data = self.queue.get(timeout=self.timeout)
            log.debug("Got {0} bytes from queue.".format(len(data)))
        except Empty:
            log.warning(
                "ControlHost timeout ({0}s) reached".format(self.timeout)
            )
            raise StopIteration("ControlHost timeout reached.")
        blob[self.key_for_prefix] = prefix
        blob[self.key_for_data] = data
        return blob
205871
def unqueue(self, timeout=10, should_wait=False):
        """"""
        start, now = time.time(), time.time()
        wait = self.queue.empty() and should_wait

        while (not self.queue.empty() or wait) and (now - start) < timeout:
            if wait and self.queue.empty():
                time.sleep(0.25)
                now = time.time()
            else:
                result = self.queue.get(False)
                self.log.debug('unqueue: result received\n%s', result)
                if result and result != "nil":
                    wait = None
                    # Restart timeout
                    start, now = time.time(), time.time()
                    _json = json.loads(result)
                    # Watch out, it may not have callId
                    call_id = _json.get("callId")
                    if _json["payload"]:
                        self.handle_incoming_response(call_id, _json["payload"])
                else:
                    self.log.debug('unqueue: nil or None received')

        if (now - start) >= timeout:
            self.log.warning('unqueue: no reply from server for %ss', timeout)
6791
def process_callback(self, block=True):
        
        try:
            (callback, args) = self._queue.get(block=block)
            try:
                callback(*args)
            finally:
                self._queue.task_done()
        except queue.Empty:
            return False
        return True
347305
def done(self):
        """"""
        # Flush the current future in the local buffer (potential deadlock
        # otherwise)
        try:
            scoop._control.execQueue.remove(self)
            scoop._control.execQueue.socket.sendFuture(self)
        except ValueError as e:
            # Future was not in the local queue, everything is fine
            pass
        # Process buffers
        scoop._control.execQueue.updateQueue()
        return self._ended()
265502
function flush() {
    if (queue) {
      result.push(queue)

      if (handleText) {
        handleText.call(textContext, queue, {start: prev, end: now()})
      }

      queue = ''
    }
  }
603229
def do_clearqueue(self, line):
        """"""
        self._split_args(line, 0, 0)
        self._command_processor.get_operation_queue().clear()
        self._print_info_if_verbose("All operations in the write queue were cleared")
604058
def pop_queue
      until @queue.empty?
        nextdir = File.join(repo_dir, @queue.pop)
        if File.directory?(nextdir)
          @next = find_next(Dir.new(nextdir))
          return @next
        else
          @logger.warn("When processing in #{@repository}, no such path #{nextdir}")
        end
      end
      @next = nil
    end
1324507
def _job_queue_empty(self):
        

        self._iteratively_clean_pending_exits()

        while self._pending_jobs:
            # We don't have any exits remaining. Let's pop out a pending exit
            pending_job = self._get_one_pending_job()
            if pending_job is None:
                continue

            self._insert_job(pending_job)
            self._register_analysis_job(pending_job.func_addr, pending_job)
            break
920906
def process_queue(queue=None, **kwargs):
    
    while True:
        item = queue.get()
        if item is None:
            queue.task_done()
            logger.info(f"{queue}: exiting process queue.")
            break
        filename = os.path.basename(item)
        try:
            queue.next_task(item, **kwargs)
        except Exception as e:
            queue.task_done()
            logger.warn(f"{queue}: item={filename}. {e}\n")
            logger.exception(e)
            sys.stdout.write(
                style.ERROR(
                    f"{queue}. item={filename}. {e}. Exception has been logged.\n"
                )
            )
            sys.stdout.flush()
            break
        else:
            logger.info(f"{queue}: Successfully processed {filename}.\n")
        queue.task_done()