TaskQueue
@constructor
@param {Number} queueCount the queue count
332719
function(queueCount) {
    var self = this;
    this.queueCount = queueCount;
    this.emitter = new EventEmitter();
    this.processedCount = 0;

    // we assume the queue count is 1
    // if developer pass no `queueCount`
    // param
    if(undefined === queueCount) {
        this.queueCount = 1;
    }

    // The listener of task done
    this.emitter.on("done", function(queueId, debugStr) {
        queueId = parseInt(queueId);
        if(isNaN(queueId)) return;
        if(queueId >= self.queueCount || queueId < 0) return;

        if(debugStr) {
            var logStr = "( Done: ";
            for(var i = 0; i < self.queue.length; i++) {
                if(i !== 0) logStr += ", ";
                logStr += "[" + self.queue[i].length + "]";
            }
            logStr += " )";
            console.log(logStr);
        }

        nextTick(function() {
            self._runTask(queueId);
        });
    });

    // initialize the tast queue into a
    // two-dimensional array
    this.queue = [];
    this.running = [];
    for(var i = 0; i < this.queueCount; i++) {
        this.queue.push([]);
        this.running.push(false);
    }

    // after finish
    this.afterFinishCount = -1;
    this.afterFinishLoop = false;
    this.afterFinishProcessor = undefined;
}
712665
@Override
    public java.util.concurrent.Future<CreateQueueResult> createQueueAsync(String queueName) {

        return createQueueAsync(new CreateQueueRequest().withQueueName(queueName));
    }
492233
function dequeue(queue, item) {
    queue[SIZE] -= 1

    let done = false
    item.action(() => {
        if (done) {
            return
        }
        done = true

        if (item.next) {
            dequeue(queue, item.next)
        }
        else {
            assert(queue[TAIL] === item, "BROKEN")
            queue[TAIL] = null
        }
    })
}
350652
def add_task(self, func, *args, **kargs):
        
        self.tasks_queue.put((func, args, kargs))
1297835
function addTask() {
        const task = newTask.value.trim();
        console.log("Adding task: " + task);

        // *****
        // *** we need to add a task to the fluence cluster after we pressed the `Add task` button
        // *****

        addTaskToFluence(task);

        updateTaskList(task)
    }
974859
function addToQueue(queue, packageInfo) {
  var exists;

  function matchesVersion(version, range) {
    var matches;

    try {
      matches = semver.satisfies(packageInfo.version, item.version);
    }
    catch (err) {
      matches = false;
    }

    return matches;
  }

  exists = queue.some(function(item) {
    var matches = false;

    if (item.name === packageInfo.name) {
      matches = matchesVersion(packageInfo.version, item.version);
    }

    return matches;
  });

  if (!exists) {
    queue.push(packageInfo);
  }
}
886996
function processQueue(queue, value) {
            if (!queue || queue.length === 0) return;
            var handler, i = 0;

            while (handler = queue[i++]) {
                handler(value);
            }
        }
248968
function enqueueTask(fn) {
  let id = nextTaskId++;
  let handle = null;
  pendingTasks[id] = () => {
    if (id in pendingTasks) {
      fn.apply(null, arguments);
      clearImmediate(handle);
      delete pendingTasks[id];
    }
  };
  handle = setImmediate(pendingTasks[id]);
}
179056
function (task, argument, callback) {
        var self = this;
        var queueArgument = {
            task: task,
            argument: argument
        };

        return promiseOrCallback(callback, function (resolve, reject) {
            self.taskQueue.push(queueArgument, function (error, result) {
                if (error) {
                    reject(error);
                } else {
                    resolve(result);
                }
            });
        });
    }
932697
function AsyncQueue(tasks, fn) {
        // better compression for shrinking `this`
        var self = this;

        // TODO: exposing this is not safe
        self.tasks = [];
        self.callbacks = [];
        self.errors = [];

        // return values of Promise
        self.data = {};

        // resolved task index
        self.nextTask = 0;

        // resolved callback index
        self.nextCallback = 0;

        // -1 (default) means not waiting for AsyncQueue#then
        self.until = -1;

        // queue is executing callback
        self.digest = false;

        // add tasks and callbacks
        self.add(tasks).whenDone(fn);
    }
187643
function queue(steps) {
  var swal = this;
  currentSteps = steps;

  var resetQueue = function resetQueue() {
    currentSteps = [];
    document.body.removeAttribute('data-swal2-queue-step');
  };

  var queueResult = [];
  return new Promise(function (resolve) {
    (function step(i, callback) {
      if (i < currentSteps.length) {
        document.body.setAttribute('data-swal2-queue-step', i);
        swal(currentSteps[i]).then(function (result) {
          if (typeof result.value !== 'undefined') {
            queueResult.push(result.value);
            step(i + 1, callback);
          } else {
            resetQueue();
            resolve({
              dismiss: result.dismiss
            });
          }
        });
      } else {
        resetQueue();
        resolve({
          value: queueResult
        });
      }
    })(0);
  });
}
856629
function Queue(owner, that) {
		this._methods = [];
		this._owner = owner;
		this._that = that;
		this._paused = false;
	}
425553
function(concurrency, tasksPerProcess) {
  this.childs = [];
  for(var i = 0; i < concurrency; i += 1) {
    this.childs[i] = new Child(tasksPerProcess);
  }
}
1111492
function taskMinus() {
      taskCounter--
      if (taskCounter === 0) {
        // Time to respond
        if (files.length === 0) {
          res.send(200, {
            result: 'no files to upload',
            files
          })
        } else {
          res.send(201, {
            result: 'upload OK',
            files
          })
        }
        next()
      }
    }
18561
function Knack({ concurrency = 5, interval = 500, onDone = () => {} }={}) {
  const q = new Queue(concurrency, interval, onDone)
  /**
   * @func knack
   * @template T
   * @param {function(...args): Promise<T>} func
   * @returns {function(...args): Promise<T>}
   */
  const knack = function(func, {
    priority = 50,
    onTimeout = timeouts.none,
    timeout = 30e3,
    repeats = 3 }={}) {
    return (...args) => q.task(func, { priority, onTimeout, timeout, repeats }, ...args)
  }
  knack.once = ({
    priority = 50,
    onTimeout = timeouts.none,
    timeout = 30e3,
    repeats = 3 }={}) => (func, ...args) => q.task(func, { priority, onTimeout, timeout, repeats }, ...args)
  knack.isHalt = false
  knack.halt = () => {
    q.tryNext = () => {}
    q.task = () => {}
    knack.isHalt = true
  }
  Object.defineProperty(knack, 'active', {
    get: () => q.active
  })
  Object.defineProperty(knack, 'concurrency', {
    get: () => q.concurrency
    // set: parallel => q.concurrency = parallel
  })
  Object.defineProperty(knack, 'interval', {
    get: () => q.interval
    // set: delay => q.interval = delay
  })
  knack.timeouts = timeouts
  return knack
}
1055553
function StartQueue() {
  data = callback = originalData = null;       //  clear existing equation, if any
  errors = sErrors; sErrors = [];              //  clear any errors
  if (!queue.length) return;    //  return if nothing to do

  serverState = STATE.BUSY;
  var result = {}, $$ = window.Array;

  //
  //  Get the math data and callback
  // and set the content with the proper script type
  //
  var item = queue.shift();
  data = item[0]; callback = item[1]; originalData = item[2];
  content.innerHTML = "";
  MathJax.HTML.addElement(content,"script",{type: "math/"+TYPES[data.format]},[data.math]);
  html.setAttribute("xmlns:"+data.xmlns,"http://www.w3.org/1998/Math/MathML");

  //
  //  Set the SVG and TeX parameters
  //  according to the requested data
  //
  var CHTML = MathJax.OutputJax.CommonHTML,
      SVG = MathJax.OutputJax.SVG,
      TEX = MathJax.InputJax.TeX,
      HUB = MathJax.Hub;

  SVG.defaultEx = CHTML.defaultEx = data.ex;
  SVG.defaultWidth = CHTMLdefaultWidth = data.width * data.ex;
  SVG.config.linebreaks.automatic = CHTML.config.linebreaks.automatic = data.linebreaks;
  SVG.config.linebreaks.width = CHTML.config.linebreaks.width = data.width * data.ex;
  SVG.config.useFontCache = data.useFontCache;
  SVG.config.useGlobalCache = data.useGlobalCache;
  TEX.config.equationNumbers.autoNumber = data.equationNumbers;

  //
  // Set the state from data.state or clear it
  //
  GetState(data.state);

  //
  // Get the renderer to use
  //
  var renderer = (
      (data.html || data.htmlNode || data.css) ? "CommonHTML" :
          (data.svg || data.svgNode) ? "SVG" : "None"
  );

  //
  //  Set up a timeout timer to restart MathJax if it runs too long,
  //  Then push the Typeset call, the MathML, speech, and SVG calls,
  //  and our TypesetDone routine
  //
  timer = setTimeout(RestartMathJax,data.timeout);
  HUB.Queue(
    $$(SetRenderer,renderer),
    $$("Process",HUB),
    $$(TypesetDone,result),
    $$(GetSpeech,result),
    $$(GetMML,result),
    $$(GetHTML,result),
    $$(RerenderSVG,result),
    $$(GetSVG,result),
    $$(ReturnResult,result)
  );
}
859358
function () {
    var self = this;

    // See how much capacity we have left to fill.
    var launchCount = this.concurrency - Object.keys(this.active).length;

    // Identify up to launchCount eligible tasks, giving priority to those earlier in the queue.
    var offset = 0;
    var launchTasks = [];
    while (launchTasks.length < launchCount && this.tasks.length > offset) {
      var task = this.tasks[offset];

      if (task.key in this.active) {
        // This task cannot run right now, so skip it.
        offset += 1;
      } else {
        // This task is eligible to run. Remove it from the queue and prepare it to launch.
        this.tasks.splice(offset, 1);
        launchTasks.push(task);
      }
    }

    // Create a task completion callback. Remove the task from the active set, invoke the tasks'
    // push() callback, then drain() again to see if another task is ready to run.
    function makeTaskHandler(task) {
      return function (err) {
        delete self.active[task.key];

        task.callback(err);

        // Defer the next drain() call again in case the task's callback was synchronous.
        process.nextTick(self.drain.bind(self));
      };
    }

    // Launch the queue handler for each chosen task.
    for (var i = 0; i < launchTasks.length; i++) {
      var each = launchTasks[i];

      this.active[each.key] = each;

      this.handler(each.job, each.config, makeTaskHandler(each));
    }

    // Fire and unset the drain callback if one has been registered.
    if (this.drainCallback) {
      var lastCallback = this.drainCallback;
      this.drainCallback = null;
      lastCallback();
    }
  }