Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/18/17 12:18:47 (7 years ago)
Author:
jkarder
Message:

#2830:

  • the asynchronous calls are now awaited
  • added extension method to flatten and handle inner exceptions of AggregateExceptions
  • fixed some catch clauses
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs

    r15287 r15367  
    352352      allAlgorithmsFinished = new ManualResetEventSlim(false);
    353353
     354      var startedTasks = new List<Task>(clonedAlgorithms.Count);
     355
    354356      //start prepared or paused cloned algorithms
    355357      foreach (IAlgorithm clonedAlgorithm in clonedAlgorithms) {
     
    360362          lock (locker) {
    361363            if (pausePending || stopPending || ExecutionState != ExecutionState.Started) break;
    362             clonedAlgorithm.StartAsync(cancellationToken);
     364            var task = clonedAlgorithm.StartAsync(cancellationToken);
     365            startedTasks.Add(task);
    363366          }
    364367        }
     
    366369
    367370      allAlgorithmsFinished.Wait();
     371
     372      Task.WaitAll(startedTasks.ToArray()); // to get exceptions not handled within the tasks
    368373    }
    369374
Note: See TracChangeset for help on using the changeset viewer.