/// <summary> /// Runs Tasks locally on distributableObject. /// </summary> /// <param name="distributableObject">The object that will run the tasks.</param> public void Distribute(IDistributable distributableObject) { using (ParallelOptionsScope.Create(ParallelOptions)) { distributableObject.RunTasks(Tasks, TaskCount); if (Cleanup) { distributableObject.Cleanup(TaskCount); } } }
/// <summary> /// Runs Tasks locally on distributableObject. /// </summary> /// <param name="distributableObject">The object that will run the tasks.</param> public void Distribute(IDistributable distributableObject) { Console.CancelKeyPress += (sender, eventArgs) => { distributableObject.Cancel(); Environment.ExitCode = -1073741510; // exit by control break }; using (ParallelOptionsScope.Create(ParallelOptions)) { distributableObject.RunTasks(Tasks, TaskCount); if (Cleanup) { distributableObject.Cleanup(TaskCount); } } }
/// <summary> /// Runs Tasks locally on distributableObject. /// </summary> /// <param name="distributableObject">The object that will run the tasks.</param> public void Distribute(IDistributable distributableObject) { Console.CancelKeyPress += (sender, eventArgs) => { distributableObject.Cancel(); Environment.ExitCode = -1073741510; // exit by control break }; using (ParallelOptionsScope.Create(ParallelOptions)) { distributableObject.RunTasks(Tasks, TaskCount); if (Cleanup) distributableObject.Cleanup(TaskCount); } }