void startTask(IVerb verb) { runningTasks += 1; IVerbWorker worker = verb.getWorker(); if (worker.isSync() == IsSync.Sync) { completeTask(verb, worker); } else { AsyncVerbTask task = new AsyncVerbTask(this, worker, verb); Say(String.Format("scheduling {0}", verb)); #pragma warning disable 162 if (debugOneThread) { task.Run(); } else { new Thread(new ThreadStart(task.Run)).Start(); } #pragma warning restore 162 } }
/// <summary> /// Starts a task (i.e. runs a verb). /// </summary> /// <param name="verb">The verb to run.</param> private void startTask(IVerb verb) { this.runningTasks += 1; // We execute the verb in a private build tree (WorkingDirectory). WorkingDirectory workingDirectory = new WorkingDirectory(BuildEngine.theEngine.getIronRoot()); // Note that we call PrepareForVerb prior to the verb's getWorker // method as the getWorker call might do some of the work directly. // REVIEW: We might want to change our contract with getWorker to // disallow it from touching files in the working directory (so we // don't have to prep the working dir in the remote execution case). this.PrepareForVerb(workingDirectory, verb); IVerbWorker worker = verb.getWorker(workingDirectory); if (worker.IsSync() == VerbWorkerType.Sync) { this.completeTask(verb, worker); } else { AsyncVerbTask task = new AsyncVerbTask(this, worker, verb); Say(string.Format("scheduling {0}", verb)); #pragma warning disable 162 if (DebugOneThread) { task.Run(); } else { new Thread(new ThreadStart(task.Run)).Start(); } #pragma warning restore 162 } }