Initializes a new instance of that class.

@param {TaskFunc<TState, TResult>} func The function to invoke.
544754
function Task(func) {
        _super.call(this);
        if (!TypeUtils.isNullOrUndefined(func)) {
            if (typeof func !== "function") {
                throw "'func' must be a function!";
            }
        }
        this._FUNC = func;
        this.updateStatus(TaskStatus.Created);
    }
537211
public static AsyncCallback<String> wrapCallback(final JavaScriptObject func) {

        return new AsyncCallback<String>() {

            public void onFailure(Throwable caught) {

                // TODO Auto-generated method stub

            }

            public void onSuccess(String result) {

                callWithString(func, result);
            }

        };
    }
19077
public void init(JavacTask task, String[] args, boolean addTaskListener) {
        env = new Env();
        for (int i = 0; i < args.length; i++) {
            String arg = args[i];
            if (arg.equals(XMSGS_OPTION)) {
                env.messages.setOptions(null);
            } else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) {
                env.messages.setOptions(arg.substring(arg.indexOf(":") + 1));
            } else if (arg.matches(XIMPLICIT_HEADERS + "[1-6]")) {
                char ch = arg.charAt(arg.length() - 1);
                env.setImplicitHeaders(Character.digit(ch, 10));
            } else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) {
                env.setCustomTags(arg.substring(arg.indexOf(":") + 1));
            } else
                throw new IllegalArgumentException(arg);
        }
        env.init(task);

        checker = new Checker(env);

        if (addTaskListener) {
            final DeclScanner ds = new DeclScanner() {
                @Override
                void visitDecl(Tree tree, Name name) {
                    TreePath p = getCurrentPath();
                    DocCommentTree dc = env.trees.getDocCommentTree(p);

                    checker.scan(dc, p);
                }
            };

            TaskListener tl = new TaskListener() {
                @Override
                public void started(TaskEvent e) {
                    switch (e.getKind()) {
                        case ANALYZE:
                            CompilationUnitTree tree;
                            while ((tree = todo.poll()) != null)
                                ds.scan(tree, null);
                            break;
                    }
                }

                @Override
                public void finished(TaskEvent e) {
                    switch (e.getKind()) {
                        case PARSE:
                            todo.add(e.getCompilationUnit());
                            break;
                    }
                }

                Queue<CompilationUnitTree> todo = new LinkedList<CompilationUnitTree>();
            };

            task.addTaskListener(tl);
        }
    }
573659
public <T> void newInstance(Local<T> target, MethodId<T, Void> constructor, Local<?>... args) {
        if (target == null) {
            throw new IllegalArgumentException();
        }
        addInstruction(new ThrowingCstInsn(Rops.NEW_INSTANCE, sourcePosition,
                RegisterSpecList.EMPTY, catches, constructor.declaringType.constant));
        moveResult(target, true);
        invokeDirect(constructor, null, target, args);
    }
538676
function invokeFunction(promise, child, func) {
  var value = promise.value;
  var state = promise.state;

  // If we have a function to run, run it
  if (typeof func === 'function') {
    try {
      value = func(value);
    } catch (err) {
      rejectPromise(child, err);
      return;
    }

    resolvePromise(child, value);
  }

  else if (state === FULFILLED) {
    resolvePromise(child, value);
  }

  else if (state === FAILED) {
    rejectPromise(child, value);
  }
}
515434
@SuppressWarnings("unchecked")
  public T queue(Function... funcs) {
    for (Element e : elements()) {
      for (Function f : funcs) {
        queue(e, DEFAULT_NAME, f);
      }
    }
    return (T) this;
  }
42594
function createTask(taskId) {
	return function (done) {
		var stream = tasks[taskId].fn(gulp, done);
		if (stream) {
			if (stream.on) stream.on('end', done);
			if (stream.then) stream.then(done);
		}
	};
}
456441
def on_task_init(self, task_id, task):
        """"""
        try:
            is_eager = task.request.is_eager
        except AttributeError:
            is_eager = False
        if not is_eager:
            self.close_database()
36614
def run_task(func):
    

    def _wrapped(*a, **k):
        gen = func(*a, **k)
        return _consume_task(gen)

    return _wrapped
904994
function init(copyObject, cb) {
		var result = 0
		isError = false
		var cbCounter = 1
		for (var to in copyObject) {
			var o = copyObjects[copyObjectsIndex++] =
				new copyobject.CopyObject(copyObject[to], to, notifyFn)
			cbCounter++
			o.doCopy(copyResult)
		}
		copyResult()

		function copyResult(err, count) {
			if (!err) {
				if (count) result += count
				if (!--cbCounter && cb) cb(null, result)
			} else if (!isError) {
				isError = true
				if (cb) cb(err)
			}
		}
	}
120825
function init(ctx) {
        _.each(resources, function (resource) {
            _.each(resource.tasks, function (taskInfo, taskName) {
                taskInfo.name = taskName;
                taskInfo.service = pancakes.getService(resource.name);
                taskHandlers[taskName] = taskInfo;
            });
        });

        return new Q(ctx);
    }
1060772
function invokeTask(taskName)
{
    const tc = TASKS.globals.globalTaskCollection;
    const t = tc.getByName(taskName);
    if (t === undefined)
    {
        YERROR.raiseError(`task ${taskName} not found`);
    }

    TASKS.invokeTask(tc, t);    
}
888754
function(funcName, expr, sup, sub) {
                    this.callBase();
                    this.setFlag("Func");
                    this.funcName = funcName;
                    this.setOperator(new FunctionOperator(funcName));
                    this.setExpr(expr);
                    this.setSuperscript(sup);
                    this.setSubscript(sub);
                }
1238005
function Task(options) {
  if (!(this instanceof Task)) {
    return new Task(options);
  }

  utils.is(this, 'task');
  use(this);

  this.options = options || {};
  if (utils.isTask(options)) {
    this.options = {};
    this.addTargets(options);
    return this;
  }
}
396579
function init() {
        // This function is called during Ghost's initialization.
        // Reading translation file for messages from core .js files and keeping its content in memory
        // The English file is always loaded, until back-end translations are enabled in future versions.
        // Before that, see previous tasks on issue #6526 (error codes or identifiers, error message
        // translation at the point of display...)
        coreStrings = fs.readFileSync(path.join(__dirname, '..', '..', 'translations', 'en.json'));

        // if translation file is not valid, you will see an error
        try {
            coreStrings = JSON.parse(coreStrings);
        } catch (err) {
            coreStrings = undefined;
            throw err;
        }

        _private.initializeIntl();
    }
566756
function TaskQueue(array) {
  array = array || [];
  if (!Array.isArray(array)) throw new Error('TaskQueue parameter must be an array.');
  else {
    this.taskQueue = array;
    this.length = array.length;
    this.index = 0;
  }
}
1259875
function() {
			this.initialized = true;
			var list = this._initcallbacks;
			if (list) {
				while (list.length) {
					list.shift()();
				}
				this._initcallbacks = null;
			}
		}