Pushes a task in the queue, so it can be processed as soon as possible.
@param {object} context
@param {function} next
336000
function (context, next) {
        if (context.options.force || !context.cached.template) {
            this._tasksQueue.push(Processor._models.task(
                context.cached._id, context.pathname, context.cached, !context.options.wait ? null :
                    function (err, cached) {
                        if (err) return next(err);
                        context.cached = cached;
                        next(null);
                    }
            ));
            if (!context.options.wait)
                next(null);
        }
        else next(null);
    }
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)
415535
function (next) {
    if (this.cancelled) return;

    debug('Running phase', this.phase);

    var tasks = [];
    var started = new Date();
    var self = this;
    var path = [];
    var env = _.cloneDeep(this.config.env);

    // need to clone the repo first
    if (this.phase === 'prepare') {
      tasks.push(this.provider.fetch.bind(this.provider, self.pluginContext(this.provider.id, env, path)));
    }

    this.plugins.forEach(function (plugin) {
      debug('Running plugin', plugin.id);
      // all plugins will get the final, fully populated env object
      _.extend(env, ('function' === typeof plugin.env) ? plugin.env(self.phase) : plugin.env);

      if ('string' === typeof plugin.path) {
        path.push(plugin.path);
      } else {
        path = path.concat('function' === typeof plugin.path ? plugin.path(self.phase) : plugin.path);
      }

      tasks.push(function (next) {
        utils.runPlugin(self.phase, plugin, self.pluginContext(plugin.id, env, path), next);
      });
    });

    async.series(tasks, this.phaseDone.bind(this, next, started));
  }
561312
def put(self, task, args, kwargs):
        
        if self.num_threads == 0:
            return task(*args, **kwargs)
        if self.queue is None:
            self._spawn()
        self.queue.put((task, args, kwargs))
1371573
public static void pushContext() {
        RpcInternalContext context = LOCAL.get();
        if (context != null) {
            Deque<RpcInternalContext> deque = DEQUE_LOCAL.get();
            if (deque == null) {
                deque = new ArrayDeque<RpcInternalContext>();
                DEQUE_LOCAL.set(deque);
            }
            deque.push(context);
            LOCAL.set(null);
        }
    }
303720
private void scheduleBatchProcess(boolean immediate) {
        synchronized (mutex) {
            if (inbox.size() == 0)
                return;

            // Schedule the processing. To improve latency, if we haven't processed anything
            // in at least our delay time, rush these object(s) through a minimum delay:
            long suggestedDelay = 0;
            if (!immediate && inbox.size() < capacity) {
                // Check with the last processed time:
                if (System.currentTimeMillis() - lastProcessedTime < delay)
                    suggestedDelay = delay;
                else {
                    // Note: iOS schedules with 0 delay but the iOS implementation
                    // works on the runloop which still allows the current thread
                    // to continue queuing objects to the batcher until going out of
                    // the runloop. Java cannot do the same so giving a small delay to
                    // allow objects to be added to the batch if available:
                    suggestedDelay = Math.min(SMALL_DELAY_AFTER_LONG_PAUSE, delay);
                }
            }
            scheduleWithDelay(suggestedDelay);
        }
    }
1010662
function next(i, p, task) {
        let iResult = task ? { value: task, done: false } : i.next();
        try {
            if (iResult.done) {
                publish($state);
                return;
            }
            const result = iResult.value($state, p);
            /* Promise(Like) */
            if (result && typeof result.then === 'function') {
                result.then(resolved, rejected);
                publish($state);
                return;
                function resolved(t) {
                    const _t = (typeof t === 'function') && t;
                    next(i, p, _t);
                }
                ;
                function rejected(err) {
                    publish($state, err);
                }
            }
            if (!iResult.done) {
                result && setState(result);
                next(i, p);
                return;
            }
        }
        catch (e) {
            publish($state, e);
        }
    }
879429
function asap(callback, context) {
	  !batchingStrategy.isBatchingUpdates ?  false ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0;
	  asapCallbackQueue.enqueue(callback, context);
	  asapEnqueued = true;
	}
1039984
function runNext() {
	if (this.locked) return false;

    var item = this.queue[0];
    if (!item) return false;

    if (item.exclusive) {
        if (this.running) return false;
        this.locked = true;
    }

    this.queue.shift();

    this.running++;

	var self = this;
	item.fn.call(item.ctx).then(function(res) {
		runDone.call(self, item, true, res);
	}, function(err) {
		runDone.call(self, item, false, err);
	});

	return true;
}
1214124
protected void pushContext(Context c) {
		Stack<Context> stack = threadSafeContextStack.get();
		if (stack == null) {
			stack = new Stack<Context>();
			stack.push(c);
			threadSafeContextStack.set(stack);
		} else {
			threadSafeContextStack.get().push(c);
		}
	}
1244433
def _push_next(self):
        """"""
        r = next(self._iter, None)
        if r is None:
            return
        async_ret = self._worker_pool.apply_async(
            self._worker_fn, (r, self._batchify_fn, self._dataset))
        self._data_buffer[self._sent_idx] = async_ret
        self._sent_idx += 1
763254
function runSync(context, func, callback)
{
  var result
    , requiresContext = isArrowFunction(func)
    ;

  try
  {
    if (requiresContext)
    {
      result = func.call(null, context);
    }
    else
    {
      result = func.call(context);
    }
  }
  catch (ex)
  {
    // pass error as error-first callback
    callback(ex);
    return;
  }

  // everything went well
  callback(null, result);
}
1171847
function next( session ) {
    if ( session !== this._session ) return;
    if ( this._index >= this._tasks.length ) {
        this._index = 0;
        this._started = false;
        delete this._session;
        this._onEnd( this );
        return;
    }

    const
        that = this,
        tsk = this._tasks[ this._index++ ];
    if ( this._debug ) {
        console.info(
            `[dom.fx] tsk[${this._index - 1}]: `, tsk.label,
            `(${Date.now() - this._startTime} ms)`, tsk.args, session
        );
    }
    tsk( function () {
        delay( next.bind( that, session ) );
    }, true );
}
537201
public void run(Context context) throws IOException, InterruptedException {
    setup(context);
    while (context.nextKey()) {
      context.progress();
      reduce(context.getCurrentKey(), context.getValues(), context);
    }
    cleanup(context);
  }
599533
function createContext(params, onNext) {

    var context = function defaultCall(err) {
        return context.next(err);
    };

    //additional parameters that are in effect beyond the object itself
    context.params = params || {};

    //keep us from calling next after a failure
    context.failed = false;


    /*
        Fail causes a hard stop of the process with the error
    */
    context.fail = function fail(err) {
        if (context.failed) throw new Error("Something caused Context.fail() to execute after the context is already failed.");
        failed = true;
        if (typeof err === "string") err = new Error(err);
        onNext(err);
    }


    /*
        Warn is a non-fatal informational warning error
    */
    context.warn = function warn(err) {
        if (typeof err === "string") err = new Error(err);
        console.log("Warning from mock context", err);
    }


    /*
        Call when you are finished with your step and are passing to the next handler
    */
    context.next = function next(err) {
        if (this.failed) throw new Error("Something caused Context.next() to execute after Context.fail().");
        if (err) return this.fail(err);
        onNext();
    }

    return context;

}
706865
function(task) {

		if (this._active_tasks.indexOf(task) == -1) {

			this._active_tasks.push(task);

		}

		this._enable();

		if (!this.is_running) {
			this._enable();
			this.is_running = true;
		}

	}
1365331
function (context, next) {
        if (context.cached.error)
            return next(context.cached.error);
        if (!context.cached.template)
            return next(new errors.Internal("For unknowns reasons, the template couldn't have been processed."));

        var opts = {
            requests: context.cached.requests,
            template: context.cached.template,
            context: context.options.solidifyContext,
            host: this.options.host,
            sessionID: context.options.sessionID
        };

        // solidify the template by feeding it.
        return this._solidify.feed(opts, function (err, result) {
            if (err)
                return next(new errors.Internal('Solidify error: ' + err.message));
            context.solidified = result;
            next(null);
        });
    }