web_modules/forge.bundle.js
function(options) {
  // task id
  this.id = -1;

  // task name
  this.name = options.name || sNoTaskName;

  // task has no parent
  this.parent = options.parent || null;

  // save run function
  this.run = options.run;

  // create a queue of subtasks to run
  this.subtasks = [];

  // error flag
  this.error = false;

  // state of the task
  this.state = READY;

  // number of times the task has been blocked (also the number
  // of permits needed to be released to continue running)
  this.blocks = 0;

  // timeout id when sleeping
  this.timeoutId = null;

  // no swap time yet
  this.swapTime = null;

  // no user data
  this.userData = null;

  // initialize task
  // FIXME: deal with overflow
  this.id = sNextTaskId++;
  sTasks[this.id] = this;
  if(sVL >= 1) {
    forge.log.verbose(cat, '[%s][%s] init', this.id, this.name, this);
  }
}
function(options) {
  // task id
  this.id = -1;

  // task name
  this.name = options.name || sNoTaskName;

  // task has no parent
  this.parent = options.parent || null;

  // save run function
  this.run = options.run;

  // create a queue of subtasks to run
  this.subtasks = [];

  // error flag
  this.error = false;

  // state of the task
  this.state = READY;

  // number of times the task has been blocked (also the number
  // of permits needed to be released to continue running)
  this.blocks = 0;

  // timeout id when sleeping
  this.timeoutId = null;

  // no swap time yet
  this.swapTime = null;

  // no user data
  this.userData = null;

  // initialize task
  // FIXME: deal with overflow
  this.id = sNextTaskId++;
  sTasks[this.id] = this;
  if(sVL >= 1) {
    forge.log.verbose(cat, '[%s][%s] init', this.id, this.name, this);
  }
}
function ( options ) { // task id
 this . id = - 1 ; // task name
 this . name = options . name || sNoTaskName ; // task has no parent
 this . parent = options . parent || null ; // save run function
 this . run = options . run ; // create a queue of subtasks to run
 this . subtasks = [ ] ; // error flag
 this . error = false ; // state of the task
 this . state = READY ; // number of times the task has been blocked (also the number
 // of permits needed to be released to continue running)
 this . blocks = 0 ; // timeout id when sleeping
 this . timeoutId = null ; // no swap time yet
 this . swapTime = null ; // no user data
 this . userData = null ; // initialize task
 // FIXME: deal with overflow
 this . id = sNextTaskId ++ ; sTasks [ this . id ] = this ; if ( sVL >= 1 ) { forge . log . verbose ( cat , '[%s][%s] init' , this . id , this . name , this ) ; } }
Creates a new task.

@param options options for this task
run: the run function for the task (required)
name: the run function for the task (optional)
parent: parent of this task (optional)

@return the empty task.
Creates a new task .